Module eclipselink

Class TableDefinition

    • Constructor Detail

      • TableDefinition

        public TableDefinition()
      • TableDefinition

        public TableDefinition​(String name)
    • Method Detail

      • addField

        public void addField​(String fieldName,
                             Class<?> type)
        PUBLIC: Add the field to the table, default sizes are used.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addField

        public void addField​(String fieldName,
                             Class<?> type,
                             int fieldSize)
        PUBLIC: Add the field to the table.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addField

        public void addField​(String fieldName,
                             Class<?> type,
                             int fieldSize,
                             int fieldSubSize)
        PUBLIC: Add the field to the table.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addField

        public void addField​(String fieldName,
                             String typeName)
        PUBLIC: Add the field to the type to a nested type.
        Parameters:
        typeName - is the name of the nested type.
      • addField

        public void addField​(FieldDefinition field)
        PUBLIC: Add the field to the table.
      • addFieldOnDatabase

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void addFieldOnDatabase​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                       FieldDefinition field)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Execute the SQL alter table to add the field to the table.
      • addForeignKeyConstraint

        public void addForeignKeyConstraint​(String name,
                                            String sourceField,
                                            String targetField,
                                            String targetTable)
        PUBLIC: Add a foreign key constraint to the table. If there is a same name foreign key constraint already, nothing will happen.
      • addUniqueKeyConstraint

        public void addUniqueKeyConstraint​(String name,
                                           String sourceField)
        PUBLIC: Add a unique key constraint to the table.
      • addUniqueKeyConstraint

        public void addUniqueKeyConstraint​(String name,
                                           String[] sourceFields)
        PUBLIC: Add a unique key constraint to the table.
      • addForeignKeyConstraint

        public void addForeignKeyConstraint​(ForeignKeyConstraint foreignKey)
        PUBLIC: Add a foreign key constraint to the table. If there is a same name foreign key constraint already, nothing will happen.
      • addUniqueKeyConstraint

        public void addUniqueKeyConstraint​(UniqueKeyConstraint uniqueKey)
        PUBLIC: Add a unique key constraint to the table.
      • addCheckConstraint

        public void addCheckConstraint​(CheckConstraint checkConstraint)
      • addIndex

        public void addIndex​(IndexDefinition index)
        PUBLIC: Add an index to the table.
      • addIdentityField

        public void addIdentityField​(String fieldName,
                                     Class<?> type)
        PUBLIC: Add the field to the table, default sizes are used. Identity fields are used on Sybase for native sequencing, The field must be of number type and cannot have a subsize.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addIdentityField

        public void addIdentityField​(String fieldName,
                                     Class<?> type,
                                     int fieldSize)
        PUBLIC: Add the field to the table, default sizes are used. Identity fields are used on Sybase for native sequencing, The field must be of number type and cannot have a subsize.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addPrimaryKeyField

        public void addPrimaryKeyField​(String fieldName,
                                       Class<?> type)
        PUBLIC: Add the field to the table, default sizes are used. This field is set as part of the primary key.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • addPrimaryKeyField

        public void addPrimaryKeyField​(String fieldName,
                                       Class<?> type,
                                       int fieldSize)
        PUBLIC: Add the field to the table, default sizes are used. This field is set as part of the primary key.
        Parameters:
        type - is the Java class type corresponding to the database type.
      • buildConstraintCreationWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public Writer buildConstraintCreationWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                    ForeignKeyConstraint foreignKey,
                                                    Writer writer)
                                             throws ValidationException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the alter table statement to add the constraints. This is done separately from the create because of dependencies.
        Throws:
        ValidationException
      • buildConstraintDeletionWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public Writer buildConstraintDeletionWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                    ForeignKeyConstraint foreignKey,
                                                    Writer writer)
                                             throws ValidationException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the alter table statement to drop the constraints. This is done separately to allow constraints to be dropped before the tables.
        Throws:
        ValidationException
      • buildUniqueConstraintCreationWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public Writer buildUniqueConstraintCreationWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                          UniqueKeyConstraint uniqueKey,
                                                          Writer writer)
                                                   throws ValidationException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the alter table statement to add the constraints. This is done separately from the create because of dependencies.
        Throws:
        ValidationException
      • buildUniqueConstraintDeletionWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public Writer buildUniqueConstraintDeletionWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                          UniqueKeyConstraint uniqueKey,
                                                          Writer writer)
                                                   throws ValidationException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the alter table statement to drop the constraints. This is done separately to allow constraints to be dropped before the tables.
        Throws:
        ValidationException
      • buildIndex

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public IndexDefinition buildIndex​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                          String key,
                                          List<String> columnNames,
                                          boolean isUniqueSetOnField)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the index creation statement.
      • buildIndexDeletionWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public Writer buildIndexDeletionWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                               String key,
                                               Writer writer,
                                               boolean isUniqueSetOnField)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the index drop statement.
      • getCreationPrefix

        public String getCreationPrefix()
        INTERNAL: Return the beginning of the sql create statement - the part before the name. Unless temp table is created should be "CREATE TABLE "
      • setCreationPrefix

        public void setCreationPrefix​(String creationPrefix)
        INTERNAL: Set the beginning of the sql create statement - the part before the name. Use to create temp. table.
      • getCreationSuffix

        public String getCreationSuffix()
        INTERNAL: Return the end of the sql create statement - the part after the field list. Unless temp table is created should be empty.
      • setCreationSuffix

        public void setCreationSuffix​(String creationSuffix)
        INTERNAL: Set the end of the sql create statement - the part after the field list.
      • getComment

        public String getComment()
      • buildDatabaseSchemaCreationWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected Writer buildDatabaseSchemaCreationWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                           Writer writer,
                                                           Set<String> createdDatabaseSchemas)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Build the create schema DDL.
      • buildDatabaseSchemaDeletionWriter

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected Writer buildDatabaseSchemaDeletionWriter​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                           Writer writer)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Build the drop schema DDL.
      • buildFieldTypes

        protected void buildFieldTypes​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Build the foreign key constraints.
      • buildForeignKeyConstraintName

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected String buildForeignKeyConstraintName​(String tableName,
                                                       String fieldName,
                                                       int maximumNameLength,
                                                       DDLPlatform platform)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Return foreign key constraint name built from the table and field name with the specified maximum length. To make the name short enough we 1. Drop the "FK_" prefix. 2. Drop the underscore characters if any. 3. Drop the vowels from the table and field name. 4. Truncate the table name to zero length if necessary.
      • buildUniqueKeyConstraintName

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected String buildUniqueKeyConstraintName​(String tableName,
                                                      int serialNumber,
                                                      int maximumNameLength)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Return unique key constraint name built from the table name and sequence number with the specified maximum length. To make the name short enough we 1. Drop the "UNQ_" prefix. 2. Drop the underscore characters if any. 3. Drop the vowels from the table name. 4. Truncate the table name to zero length if necessary.
      • buildIndexName

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        protected String buildIndexName​(String tableName,
                                        String key,
                                        String indexPrefix,
                                        int maximumNameLength,
                                        DDLPlatform platform)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Return key constraint name built from the table and key name with the specified maximum length and index prefix. If indexPrefix is null, "IX_" is used for prefix. To make the name short enough we:
         1. Drop the prefix.
         2. Drop the underscore characters if any.
         3. Drop the vowels from the table and key name.
         4. Truncate the table name to zero length if necessary.
         
      • createConstraints

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void createConstraints​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                      Writer schemaWriter)
                               throws EclipseLinkException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Execute the SQL alter table constraint creation string.
        Throws:
        EclipseLinkException
      • createConstraintsOnDatabase

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void createConstraintsOnDatabase​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                         throws EclipseLinkException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Execute the SQL alter table constraint creation string.
        Throws:
        EclipseLinkException
      • createIndexes

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void createIndexes​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                  Writer writer)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL:
        Write the SQL create index string to create index if passed a writer, else delegate to a method that executes the string on the database.
        Throws:
        ValidationException - wraps any IOException from the writer
      • writeLineSeperator

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void writeLineSeperator​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                       Writer writer)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • deletionStringFor

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public String deletionStringFor​(org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor accessor)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Return the delete SQL string.
      • dropConstraints

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void dropConstraints​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                    Writer schemaWriter)
                             throws EclipseLinkException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Execute the SQL alter table constraint creation string.
        Throws:
        EclipseLinkException
      • dropConstraintsOnDatabase

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void dropConstraintsOnDatabase​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                       throws EclipseLinkException
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Execute the SQL alter table constraint creation string. Exceptions are caught and masked so that all the foreign keys are dropped (even if they don't exist).
        Throws:
        EclipseLinkException
      • dropIndexes

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void dropIndexes​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                Writer writer)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL:
        Write the SQL drop index string to drop indexes if passed a writer, else delegate to a method that executes the string on the database.
        Throws:
        ValidationException - wraps any IOException from the writer
      • getField

        public FieldDefinition getField​(String fieldName)
        PUBLIC: Return the field the corresponds to the name.
      • setCreateVPDCalls

        public void setCreateVPDCalls​(boolean createVPDCalls,
                                      String tenantFieldName)
        PUBLIC:
      • getPrimaryKeyFieldNames

        public List<String> getPrimaryKeyFieldNames()
        PUBLIC:
      • postCreateObject

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void postCreateObject​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                     Writer createSchemaWriter,
                                     boolean createSQLFiles)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Execute any statements required after the creation of the object
        Overrides:
        postCreateObject in class DatabaseObjectDefinition
      • preDropObject

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void preDropObject​(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                  Writer dropSchemaWriter,
                                  boolean createSQLFiles)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Execute any statements required before the deletion of the object
        Overrides:
        preDropObject in class DatabaseObjectDefinition
      • setForeignKeys

        public void setForeignKeys​(List<ForeignKeyConstraint> foreignKeys)
        PUBLIC: Set the ForeignKeyConstraint list. If the list contains the same name foreign key constraints, only the first one of that name will be added.
      • setUserDefinedForeignKeyConstraints

        public void setUserDefinedForeignKeyConstraints​(Map<String,​ForeignKeyConstraint> foreignKeyConstraints)
        PUBLIC: Set the foreign key constraints for this table.
      • shouldCreateVPDCalls

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public boolean shouldCreateVPDCalls​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        Deprecated, for removal: This API element is subject to removal in a future version.
        INTERNAL: Subclasses who care should override this method.
        Overrides:
        shouldCreateVPDCalls in class DatabaseObjectDefinition
      • setCreateSQLFiles

        public void setCreateSQLFiles​(boolean genFlag)
        PUBLIC:
      • getTable

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public org.eclipse.persistence.internal.helper.DatabaseTable getTable()
        Deprecated, for removal: This API element is subject to removal in a future version.
      • setTable

        @Deprecated(forRemoval=true,
                    since="4.0.9")
        public void setTable​(org.eclipse.persistence.internal.helper.DatabaseTable table)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • setComment

        public void setComment​(String comment)