Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.MetaDataException


     * Parse @TableGenerator.
     */
    private void parseTableGenerator(AnnotatedElement el, TableGenerator gen) {
        String name = gen.name();
        if (StringUtils.isEmpty(name))
            throw new MetaDataException(_loc.get("no-gen-name", el));

        Log log = getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("parse-gen", name));

View Full Code Here


        JoinColumn[] scols;
        int unique;
        List<Column> jcols;
        for (AssociationOverride assoc : assocs) {
            if (StringUtils.isEmpty(assoc.name()))
                throw new MetaDataException(_loc.get("no-override-name", cm));
            sup = (FieldMapping) cm.getDefinedSuperclassField(assoc.name());
            if (sup == null)
                sup = (FieldMapping) cm.addDefinedSuperclassField
                    (assoc.name(), Object.class, Object.class);
            scols = assoc.joinColumns();
View Full Code Here

    private void parseAttributeOverrides(ClassMapping cm,
        AttributeOverride... attrs) {
        FieldMapping sup;
        for (AttributeOverride attr : attrs) {
            if (StringUtils.isEmpty(attr.name()))
                throw new MetaDataException(_loc.get("no-override-name", cm));
            sup = (FieldMapping) cm.getDefinedSuperclassField(attr.name());
            if (sup == null)
                sup = (FieldMapping) cm.addDefinedSuperclassField(attr.name(),
                    Object.class, Object.class);
            if (attr.column() != null)
View Full Code Here

        List<Column> joins;
        boolean warnUnique = false;
        for (SecondaryTable table : tables) {
            name = table.name();
            if (StringUtils.isEmpty(name))
                throw new MetaDataException(_loc.get("second-name", cm));
            if (!StringUtils.isEmpty(table.schema()))
                name = table.schema() + "." + name;
            if (table.pkJoinColumns().length > 0) {
                joins = new ArrayList<Column>(table.pkJoinColumns().length);
                for (PrimaryKeyJoinColumn join : table.pkJoinColumns())
View Full Code Here

    private void parseMappingOverrides(ClassMapping cm,
        MappingOverride... overs) {
        FieldMapping sup;
        for (MappingOverride over : overs) {
            if (StringUtils.isEmpty(over.name()))
                throw new MetaDataException(_loc.get("no-override-name", cm));
            sup = (FieldMapping) cm.getDefinedSuperclassField(over.name());
            if (sup == null)
                sup = (FieldMapping) cm.addDefinedSuperclassField(over.name(),
                    Object.class, Object.class);
            populate(sup, over);
View Full Code Here

     */
    private void parseAssociationOverrides(FieldMapping fm,
        AssociationOverride... assocs) {
        ClassMapping embed = fm.getEmbeddedMapping();
        if (embed == null)
            throw new MetaDataException(_loc.get("not-embedded", fm));

        FieldMapping efm;
        JoinColumn[] ecols;
        int unique;
        List<Column> jcols;
        for (AssociationOverride assoc : assocs) {
            efm = embed.getFieldMapping(assoc.name());
            if (efm == null)
                throw new MetaDataException(_loc.get("embed-override-name",
                    fm, assoc.name()));
            ecols = assoc.joinColumns();
            if (ecols == null || ecols.length == 0)
                continue;

View Full Code Here

     */
    private void parseAttributeOverrides(FieldMapping fm,
        AttributeOverride... attrs) {
        ClassMapping embed = fm.getEmbeddedMapping();
        if (embed == null)
            throw new MetaDataException(_loc.get("not-embedded", fm));

        FieldMapping efm;
        for (AttributeOverride attr : attrs) {
            efm = embed.getFieldMapping(attr.name());
            if (efm == null)
                throw new MetaDataException(_loc.get("embed-override-name",
                    fm, attr.name()));
            if (attr.column() != null)
                parseColumns(efm, attr.column());
        }
    }
View Full Code Here

     * Parse @Temporal.
     */
    private void parseTemporal(FieldMapping fm, Temporal anno) {
        List cols = fm.getValueInfo().getColumns();
        if (!cols.isEmpty() && cols.size() != 1)
            throw new MetaDataException(_loc.get("num-cols-mismatch", fm,
                String.valueOf(cols.size()), "1"));
        if (cols.isEmpty()) {
            cols = Arrays.asList(new Column[]{ new Column() });
            fm.getValueInfo().setColumns(cols);
        }
View Full Code Here

            return;

        // might already have some column information from mapping annotation
        List cols = fm.getValueInfo().getColumns();
        if (!cols.isEmpty() && cols.size() != pcols.length)
            throw new MetaDataException(_loc.get("num-cols-mismatch", fm,
                String.valueOf(cols.size()), String.valueOf(pcols.length)));

        // cache the JAXB XmlType class if it is present so we do not
        // have a hard-wired dependency on JAXB here
        Class xmlTypeClass = null;
View Full Code Here

        if (StringUtils.isEmpty(colSecondary))
            colSecondary = null;
        if (col == 0)
            return colSecondary;
        if (!StringUtils.equalsIgnoreCase(secondary, colSecondary))
            throw new MetaDataException(_loc.get("second-inconsist", fm));
        return secondary;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.MetaDataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.