public class DefaultTableGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
databaseFields
DatabaseField pool (synchronized with above 'fieldMap')
|
protected org.eclipse.persistence.internal.databaseaccess.DatabasePlatform |
databasePlatform
the target database platform.
|
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,FieldDefinition> |
fieldMap
Used to track the field definition: keyed by the database field object, and
valued by the field definition.
|
protected boolean |
generateFKConstraints
When this flag is 'false' EclipseLink will not attempt to create fk constraints.
|
protected java.util.Map<java.lang.String,TableDefinition> |
tableMap
Used to track the table definition: keyed by the table name, and valued
by the table definition object.
|
Constructor and Description |
---|
DefaultTableGenerator(Project project)
Default constructor
|
DefaultTableGenerator(Project project,
boolean generateFKConstraints)
This constructor will create a DefaultTableGenerator that can be set to create fk
constraints
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFieldsForMappedKeyMapContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy cp,
TableDefinition table)
The ContainerPolicy may contain some additional fields that should be added to the table
|
protected void |
addForeignKeyConstraint(TableDefinition sourceTableDef,
TableDefinition targetTableDef,
java.util.List<java.lang.String> fkFields,
java.util.List<java.lang.String> targetFields,
boolean cascadeOnDelete)
Add a foreign key constraint to the source table.
|
protected void |
addForeignKeyFieldToSourceTargetTable(OneToManyMapping mapping) |
protected void |
addForeignKeyFieldToSourceTargetTable(OneToOneMapping mapping) |
protected void |
addForeignMappingFkConstraint(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> srcFields,
boolean cascadeOnDelete) |
protected void |
addJoinColumnsFkConstraint(java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> fkFields,
java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> targetFields,
boolean cascadeOnDelete) |
protected void |
addUniqueKeyConstraints(TableDefinition sourceTableDef,
java.util.Map<java.lang.String,java.util.List<java.util.List<java.lang.String>>> uniqueConstraintsMap) |
protected void |
buildDirectCollectionTableDefinition(DirectCollectionMapping mapping,
ClassDescriptor descriptor)
Build direct collection table definitions in a EclipseLink descriptor
|
protected void |
buildRelationTableDefinition(ForeignReferenceMapping mapping,
RelationTableMechanism relationTableMechanism,
org.eclipse.persistence.internal.helper.DatabaseField listOrderField,
org.eclipse.persistence.internal.queries.ContainerPolicy cp)
Build relation table definitions for all many-to-many relationships in a EclipseLink descriptor.
|
protected void |
buildRelationTableFields(ForeignReferenceMapping mapping,
TableDefinition table,
java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> fkFields,
java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> targetFields)
Build field definitions and foreign key constraints for all many-to-many relation table.
|
protected void |
createAggregateTargetTable(AggregateCollectionMapping mapping)
Add the foreign key to the aggregate collection mapping target table.
|
TableCreator |
generateDefaultTableCreator()
Generate a default TableCreator object from the EclipseLink project object.
|
TableCreator |
generateFilteredDefaultTableCreator(org.eclipse.persistence.internal.sessions.AbstractSession session)
Generate a default TableCreator object from the EclipseLink project object,
and perform the table existence check through jdbc table metadata, and filter out
tables which are already in the database.
|
protected FieldDefinition |
getFieldDefFromDBField(org.eclipse.persistence.internal.helper.DatabaseField dbField)
Build a field definition object from a database field.
|
protected TableDefinition |
getTableDefFromDBTable(org.eclipse.persistence.internal.helper.DatabaseTable databaseTable)
Build a table definition object from a database table object
|
protected void |
initTableSchema(ClassDescriptor descriptor)
Build tables/fields information into the table creator object from a EclipseLink descriptor.
|
protected void |
postInitTableSchema(ClassDescriptor descriptor)
Build additional table/field definitions for the descriptor, like relation table
and direct-collection, direct-map table, as well as reset LOB type for serialized
object mapping and type conversion mapping for LOB usage
|
protected void |
processAdditionalTablePkFields(ClassDescriptor descriptor) |
protected void |
resetFieldTypeForLOB(DirectToFieldMapping mapping)
Reset field type to use BLOB/CLOB with type conversion mapping fix for 4k oracle thin driver bug.
|
protected void |
resetTransformedFieldType(TransformationMapping mapping)
Reset the transformation mapping field types
|
protected org.eclipse.persistence.internal.helper.DatabaseField |
resolveDatabaseField(org.eclipse.persistence.internal.helper.DatabaseField childField,
org.eclipse.persistence.internal.helper.DatabaseField parentField)
Resolve the foreign key database field metadata in relation table or direct collection/map table.
|
protected void |
setFieldToRelationTable(org.eclipse.persistence.internal.helper.DatabaseField dbField,
TableDefinition table)
Build and add a field definition object to relation table
|
protected org.eclipse.persistence.internal.databaseaccess.DatabasePlatform databasePlatform
protected java.util.Map<java.lang.String,TableDefinition> tableMap
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,FieldDefinition> fieldMap
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> databaseFields
protected boolean generateFKConstraints
public DefaultTableGenerator(Project project)
public DefaultTableGenerator(Project project, boolean generateFKConstraints)
public TableCreator generateDefaultTableCreator()
public TableCreator generateFilteredDefaultTableCreator(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DatabaseException
DatabaseException
protected void initTableSchema(ClassDescriptor descriptor)
protected void postInitTableSchema(ClassDescriptor descriptor)
protected void addFieldsForMappedKeyMapContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy cp, TableDefinition table)
MappedKeyMapContainerPolicy
protected void buildRelationTableDefinition(ForeignReferenceMapping mapping, RelationTableMechanism relationTableMechanism, org.eclipse.persistence.internal.helper.DatabaseField listOrderField, org.eclipse.persistence.internal.queries.ContainerPolicy cp)
protected void buildRelationTableFields(ForeignReferenceMapping mapping, TableDefinition table, java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> fkFields, java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> targetFields)
protected void buildDirectCollectionTableDefinition(DirectCollectionMapping mapping, ClassDescriptor descriptor)
protected void resetFieldTypeForLOB(DirectToFieldMapping mapping)
protected void resetTransformedFieldType(TransformationMapping mapping)
protected void createAggregateTargetTable(AggregateCollectionMapping mapping)
protected void addForeignKeyFieldToSourceTargetTable(OneToOneMapping mapping)
protected void addForeignKeyFieldToSourceTargetTable(OneToManyMapping mapping)
protected void addForeignMappingFkConstraint(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> srcFields, boolean cascadeOnDelete)
protected TableDefinition getTableDefFromDBTable(org.eclipse.persistence.internal.helper.DatabaseTable databaseTable)
protected org.eclipse.persistence.internal.helper.DatabaseField resolveDatabaseField(org.eclipse.persistence.internal.helper.DatabaseField childField, org.eclipse.persistence.internal.helper.DatabaseField parentField)
protected FieldDefinition getFieldDefFromDBField(org.eclipse.persistence.internal.helper.DatabaseField dbField)
protected void setFieldToRelationTable(org.eclipse.persistence.internal.helper.DatabaseField dbField, TableDefinition table)
protected void processAdditionalTablePkFields(ClassDescriptor descriptor)
protected void addJoinColumnsFkConstraint(java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> fkFields, java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> targetFields, boolean cascadeOnDelete)
protected void addForeignKeyConstraint(TableDefinition sourceTableDef, TableDefinition targetTableDef, java.util.List<java.lang.String> fkFields, java.util.List<java.lang.String> targetFields, boolean cascadeOnDelete)
protected void addUniqueKeyConstraints(TableDefinition sourceTableDef, java.util.Map<java.lang.String,java.util.List<java.util.List<java.lang.String>>> uniqueConstraintsMap)