Examples of TableGeneratorMetaData


Examples of org.datanucleus.metadata.TableGeneratorMetaData

                    {
                        // Add a dummy (root) package to hold our sequences since no default package name set
                        pmd = filemd.newPackageMetadata("");
                    }
                }
                TableGeneratorMetaData tgmd = pmd.newTableGeneratorMetadata(getAttr(attrs, "name"));
                tgmd.setTableName(getAttr(attrs, "table"));
                tgmd.setCatalogName(getAttr(attrs, "catalog"));
                tgmd.setSchemaName(getAttr(attrs, "schema"));
                tgmd.setPKColumnName(getAttr(attrs, "pk-column-name"));
                tgmd.setPKColumnValue(getAttr(attrs, "pk-column-value"));
                tgmd.setValueColumnName(getAttr(attrs, "value-column-name"));
                tgmd.setInitialValue(getAttr(attrs, "initial-value"));
                tgmd.setAllocationSize(getAttr(attrs, "allocation-size"));
            }
            else if (localName.equals("named-query"))
            {
                // Named JPQL query
                MetaData md = getStack();
View Full Code Here

Examples of org.datanucleus.metadata.TableGeneratorMetaData

     * @param pmd Package MetaData to add the table generator to
     * @param annotationValues The annotation info
     */
    private void processTableGeneratorAnnotation(PackageMetaData pmd, HashMap<String, Object> annotationValues)
    {
        TableGeneratorMetaData tgmd = pmd.newTableGeneratorMetadata((String)annotationValues.get("name"));
        tgmd.setTableName((String)annotationValues.get("table"));
        tgmd.setCatalogName((String)annotationValues.get("catalog"));
        tgmd.setSchemaName((String)annotationValues.get("schema"));
        tgmd.setPKColumnName((String)annotationValues.get("pkColumnName"));
        tgmd.setPKColumnValue((String)annotationValues.get("pkColumnValue"));
        tgmd.setValueColumnName((String)annotationValues.get("valueColumnName"));
        tgmd.setInitialValue((Integer)annotationValues.get("initialValue"));
        tgmd.setAllocationSize((Integer)annotationValues.get("allocationSize"));
        // TODO Support uniqueConstraints
    }
View Full Code Here

Examples of org.datanucleus.metadata.TableGeneratorMetaData

        AbstractMemberMetaData mmd = null;
        String fieldName = null;
        IdentityStrategy strategy = null;
        String sequence = null;
        String valueGeneratorName = null;
        TableGeneratorMetaData tableGeneratorMetaData = null;
        SequenceMetaData sequenceMetaData = null;
        if (absoluteFieldNumber >= 0)
        {
            // real field
            mmd = cmd.getMetaDataForManagedMemberAtAbsolutePosition(absoluteFieldNumber);
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

        } else if (name.equals(DEFAULT_IDENTITY_GENERATOR)) {
            throw ValidationException.sequenceGeneratorUsingAReservedName(DEFAULT_IDENTITY_GENERATOR, sequenceGenerator.getLocation());
        }
       
        // Check if the name is used with a table generator.
        TableGeneratorMetadata tableGenerator = m_tableGenerators.get(name);
        if (tableGenerator != null) {
            throw ValidationException.conflictingSequenceAndTableGeneratorsSpecified(name, sequenceGenerator.getLocation(), tableGenerator.getLocation());         
        }
           
        for (TableGeneratorMetadata otherTableGenerator : m_tableGenerators.values()) {
            if (otherTableGenerator.getPkColumnValue().equals(sequenceGenerator.getSequenceName())) {
                // generator name will be used instead of an empty sequence name / pk column name
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

            m_sequenceGenerator = new SequenceGeneratorMetadata(getAnnotation(SequenceGenerator.class), accessibleObject);
        }
       
        // Set the table generator if one is present.       
        if (isAnnotationPresent(TableGenerator.class)) {
            m_tableGenerator = new TableGeneratorMetadata(getAnnotation(TableGenerator.class), accessibleObject);
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

     * Process a TableGenerator annotation into a common metadata table
     * generator and add it to the project.
     */
    protected void processTableGenerator() {
        if (isAnnotationPresent(TableGenerator.class)) {
            getProject().addTableGenerator(new TableGeneratorMetadata(getAnnotation(TableGenerator.class), getAccessibleObject()), getDescriptor().getDefaultCatalog(), getDescriptor().getDefaultSchema());
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

        sequenceGenerator.setCatalog(MetadataHelper.getName(sequenceGenerator.getCatalog(), defaultCatalog, sequenceGenerator.getCatalogContext(), m_logger, sequenceGenerator.getLocation()));
        // Schema could be "" or null, need to check for an XML default.
        sequenceGenerator.setSchema(MetadataHelper.getName(sequenceGenerator.getSchema(), defaultSchema, sequenceGenerator.getSchemaContext(), m_logger, sequenceGenerator.getLocation()));
       
        // Check if the name is used with a table generator.
        TableGeneratorMetadata tableGenerator = m_tableGenerators.get(name);
        if (tableGenerator != null) {
            if (sequenceGenerator.shouldOverride(tableGenerator)) {
                m_tableGenerators.remove(name);
            } else {
                throw ValidationException.conflictingSequenceAndTableGeneratorsSpecified(name, sequenceGenerator.getLocation(), tableGenerator.getLocation());
            }
        }
           
        for (TableGeneratorMetadata otherTableGenerator : m_tableGenerators.values()) {
            if ((tableGenerator != otherTableGenerator) && (otherTableGenerator.getPkColumnValue() != null) && otherTableGenerator.getPkColumnValue().equals(sequenceGenerator.getSequenceName())) {                // generator name will be used instead of an empty sequence name / pk column name
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

     */
    public void addUuidGenerator(UuidGeneratorMetadata uuidGenerator) {
        String name = uuidGenerator.getName();
       
        // Check if the name is used with a table generator.
        TableGeneratorMetadata tableGenerator = m_tableGenerators.get(name);
        if (tableGenerator != null) {
            if (uuidGenerator.shouldOverride(tableGenerator)) {
                m_tableGenerators.remove(name);
            } else {
                throw ValidationException.conflictingSequenceAndTableGeneratorsSpecified(name, uuidGenerator.getLocation(), tableGenerator.getLocation());
            }
        }

        m_uuidGenerators.put(uuidGenerator.getName(), uuidGenerator);
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

            }

            // 2 - Check if the user defined default generators, otherwise
            // create them using the Table and Sequence generator metadata.
            if (! sequences.containsKey(DEFAULT_TABLE_GENERATOR)) {
                TableGeneratorMetadata tableGenerator = new TableGeneratorMetadata(DEFAULT_TABLE_GENERATOR);
               
                // This code was attempting to use the platform default sequence name,
                // however the platform has not been set yet, so it would never work,
                // it was also causing the platform default sequence to be set, causing the DatabasePlatform default to be used,
                // so I am removing this code, as it breaks the platform default sequence and does not work.
                // Sequence seq = m_session.getDatasourcePlatform().getDefaultSequence();
                // Using "" as the default should make the platform default it.
                String defaultTableGeneratorName = "";
                // Process the default values.
                processTable(tableGenerator, defaultTableGeneratorName, getPersistenceUnitDefaultCatalog(), getPersistenceUnitDefaultSchema(), tableGenerator);
               
                sequences.put(DEFAULT_TABLE_GENERATOR, tableGenerator.process(m_logger));
            }
           
            if (! sequences.containsKey(DEFAULT_SEQUENCE_GENERATOR)) {
                sequences.put(DEFAULT_SEQUENCE_GENERATOR, new SequenceGeneratorMetadata(DEFAULT_SEQUENCE_GENERATOR, getPersistenceUnitDefaultCatalog(), getPersistenceUnitDefaultSchema()).process(m_logger));
            }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.sequencing.TableGeneratorMetadata

            m_sequenceGenerator = new SequenceGeneratorMetadata(getAnnotation(SequenceGenerator.class), accessibleObject);
        }
       
        // Set the table generator if one is present.       
        if (isAnnotationPresent(TableGenerator.class)) {
            m_tableGenerator = new TableGeneratorMetadata(getAnnotation(TableGenerator.class), accessibleObject);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.