Package org.apache.openjpa.jdbc.meta

Examples of org.apache.openjpa.jdbc.meta.SequenceMapping


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

        SequenceMapping meta = (SequenceMapping) getRepository().
            getCachedSequenceMetaData(name);
        if (meta != null) {
            if (log.isWarnEnabled())
                log.warn(_loc.get("dup-gen", name, el));
            return;
        }

        meta = (SequenceMapping) getRepository().addSequenceMetaData(name);
        meta.setSequencePlugin(SequenceMapping.IMPL_VALUE_TABLE);
        String schema = _dict.delimitString(gen.schema(),
            DBDictionary.DBIdentifiers.TABLE_GEN_SCHEMA);
        String table = _dict.delimitString(gen.table(),
            DBDictionary.DBIdentifiers.TABLE_GEN_TABLE);
        meta.setTable(toTableName(schema,table));
        String pkColumnName = _dict.delimitString(gen.pkColumnName(),
            DBDictionary.DBIdentifiers.TABLE_GEN_PK_COLUMN);
        meta.setPrimaryKeyColumn(pkColumnName);
        String valueColumnName = _dict.delimitString(gen.valueColumnName(),
            DBDictionary.DBIdentifiers.TABLE_GEN_VALUE_COLUMN);
        meta.setSequenceColumn(valueColumnName);
        meta.setPrimaryKeyValue(gen.pkColumnValue());
        meta.setInitialValue(gen.initialValue());
        meta.setAllocate(gen.allocationSize());
        meta.setSource(getSourceFile(), (el instanceof Class) ? el : null,
            meta.SRC_ANNOTATIONS);
       
        switch (gen.uniqueConstraints().length) {
        case 0:
          break; // nothing to do
        case 1:
          meta.setUniqueColumns(gen.uniqueConstraints()[0].columnNames());
          meta.setUniqueConstraintName(gen.uniqueConstraints()[0].name());
          break;
        default:
          log.warn(_loc.get("unique-many-on-seq-unsupported", el, name));
        }
    }
View Full Code Here


            log.trace(_loc.get("parse-gen", name));
        if (getRepository().getCachedSequenceMetaData(name) != null
            && log.isWarnEnabled())
            log.warn(_loc.get("override-gen", name));

        SequenceMapping seq = (SequenceMapping) getRepository().
            addSequenceMetaData(name);
        seq.setSequencePlugin(SequenceMapping.IMPL_VALUE_TABLE);
        seq.setTable(toTableName(attrs.getValue("schema"),
            attrs.getValue("table")));
        seq.setPrimaryKeyColumn(attrs.getValue("pk-column-name"));
        seq.setSequenceColumn(attrs.getValue("value-column-name"));
        seq.setPrimaryKeyValue(attrs.getValue("pk-column-value"));
        String val = attrs.getValue("initial-value");
        if (val != null)
            seq.setInitialValue(Integer.parseInt(val));
        val = attrs.getValue("allocation-size");
        if (val != null)
            seq.setAllocate(Integer.parseInt(val));

        Object cur = currentElement();
        Object scope = (cur instanceof ClassMetaData)
            ? ((ClassMetaData) cur).getDescribedType() : null;
        seq.setSource(getSourceFile(), scope, seq.SRC_XML);
        return true;
    }
View Full Code Here

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

        SequenceMapping meta = (SequenceMapping) getRepository().
            getCachedSequenceMetaData(name);
        if (meta != null) {
            if (log.isWarnEnabled())
                log.warn(_loc.get("dup-gen", name, el));
            return;
        }

        meta = (SequenceMapping) getRepository().addSequenceMetaData(name);
        meta.setSequencePlugin(SequenceMapping.IMPL_VALUE_TABLE);
        meta.setTable(toTableName(gen.schema(), gen.table()));
        meta.setPrimaryKeyColumn(gen.pkColumnName());
        meta.setSequenceColumn(gen.valueColumnName());
        meta.setPrimaryKeyValue(gen.pkColumnValue());
        meta.setInitialValue(gen.initialValue());
        meta.setAllocate(gen.allocationSize());
        meta.setSource(getSourceFile(), (el instanceof Class) ? el : null,
            meta.SRC_ANNOTATIONS);

        //### EJB3
        if (gen.uniqueConstraints().length > 0 && log.isWarnEnabled())
            log.warn(_loc.get("unique-constraints", name));
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.meta.SequenceMapping

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.