Class PersistenceMappingDefaults
java.lang.Object
org.apache.openjpa.jdbc.meta.MappingDefaultsImpl
org.apache.openjpa.persistence.jdbc.PersistenceMappingDefaults
- All Implemented Interfaces:
MappingDefaults
,Configurable
Supplies default mapping information in accordance with JPA spec.
- Author:
- Steve Kim, Abe White
-
Field Summary
Fields inherited from class org.apache.openjpa.jdbc.meta.MappingDefaultsImpl
dict
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether to prepend the field name to the default name of inverse join columns within join tables.getStrategy
(Discriminator disc, boolean adapt) Default discriminator mapping strategy when there is no explicit strategy.getStrategy
(Version vers, boolean adapt) Default version mapping strategy when there is no explicit strategy.getTableIdentifier
(FieldMapping fm, Schema schema) Return the default secondary table name for the given field.getTableName
(ClassMapping cls, Schema schema) Return the default table name for the given class.getTableName
(FieldMapping fm, Schema schema) Return the default secondary table name for the given field.void
populateColumns
(Version vers, Table table, Column[] cols) Fill in default information for the given version columns.void
populateForeignKeyColumn
(ValueMapping vm, String name, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols) Fill in default information for the given column used to join a value to its related type.void
populateForeignKeyColumn
(ValueMapping vm, DBIdentifier sName, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols) Fill in default information for the given column used to join a value to its related type.void
populateJoinColumn
(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) Fill in default information for the given column used to join a field to its defining class' table.void
setPrependFieldNameToJoinTableInverseJoinColumns
(boolean val) Whether to prepend the field name to the default name of inverse join columns within join tables.Methods inherited from class org.apache.openjpa.jdbc.meta.MappingDefaultsImpl
areAllPrimaryKeyColumns, correctName, defaultMissingInfo, endConfiguration, getAddNullIndicator, getBaseClassStrategy, getDataStoreIdColumnIdentifier, getDataStoreIdColumnName, getDeferConstraints, getDiscriminatorColumnIdentifier, getDiscriminatorColumnName, getDiscriminatorStrategy, getDiscriminatorValue, getFieldStrategy, getForeignKey, getForeignKey, getForeignKeyDeleteAction, getIndex, getIndex, getIndex, getIndex, getIndexDiscriminator, getIndexLogicalForeignKeys, getIndexName, getIndexName, getIndexPhysicalForeignKeys, getIndexVersion, getJoinForeignKey, getJoinForeignKey, getJoinForeignKeyDeleteAction, getJoinIndex, getJoinUnique, getNullIndicatorColumnIdentifier, getNullIndicatorColumnName, getOrderColumnIdentifier, getOrderColumnName, getOrderLists, getPrimaryKeyIdentifier, getPrimaryKeyName, getStoreEnumOrdinal, getStoreUnmappedObjectIdString, getStrategy, getStrategy, getSubclassStrategy, getTableIdentifier, getUnique, getUnique, getVersionColumnIdentifier, getVersionColumnName, getVersionStrategy, installPrimaryKey, isRemoveHungarianNotation, populateColumns, populateColumns, populateColumns, populateDataStoreIdColumns, populateJoinColumn, populateNullIndicatorColumns, populateNullIndicatorColumns, populateOrderColumns, removeHungarianNotation, setAddNullIndicator, setBaseClassStrategy, setConfiguration, setDataStoreIdColumnIdentifier, setDataStoreIdColumnName, setDefaultMissingInfo, setDeferConstraints, setDiscriminatorColumnIdentifier, setDiscriminatorColumnName, setDiscriminatorStrategy, setFieldStrategies, setFieldStrategy, setForeignKeyDeleteAction, setForeignKeyDeleteAction, setIndexDiscriminator, setIndexLogicalForeignKeys, setIndexPhysicalForeignKeys, setIndexVersion, setJoinForeignKeyDeleteAction, setJoinForeignKeyDeleteAction, setNullIndicatorColumnIdentifier, setNullIndicatorColumnName, setOrderColumnIdentifier, setOrderColumnName, setOrderLists, setRemoveHungarianNotation, setStoreEnumOrdinal, setStoreUnmappedObjectIdString, setSubclassStrategy, setUseClassCriteria, setVersionColumnIdentifier, setVersionColumnName, setVersionStrategy, startConfiguration, useClassCriteria
-
Constructor Details
-
PersistenceMappingDefaults
public PersistenceMappingDefaults()
-
-
Method Details
-
getPrependFieldNameToJoinTableInverseJoinColumns
public boolean getPrependFieldNameToJoinTableInverseJoinColumns()Whether to prepend the field name to the default name of inverse join columns within join tables. Defaults to true per spec, but set to false for compatibility with older versions of OpenJPA. -
setPrependFieldNameToJoinTableInverseJoinColumns
public void setPrependFieldNameToJoinTableInverseJoinColumns(boolean val) Whether to prepend the field name to the default name of inverse join columns within join tables. Defaults to true per spec, but set to false for compatibility with older versions of OpenJPA. -
getStrategy
Description copied from interface:MappingDefaults
Default version mapping strategy when there is no explicit strategy.- Specified by:
getStrategy
in interfaceMappingDefaults
- Overrides:
getStrategy
in classMappingDefaultsImpl
- Parameters:
vers
- the version; will not be mapped, but rawMappingInfo
will be availableadapt
- whether we can adapt the mapping or schema- Returns:
- the strategy alias or a strategy instance, or null
-
getStrategy
Description copied from interface:MappingDefaults
Default discriminator mapping strategy when there is no explicit strategy.- Specified by:
getStrategy
in interfaceMappingDefaults
- Overrides:
getStrategy
in classMappingDefaultsImpl
- Parameters:
disc
- the discriminator; will not be mapped, but rawMappingInfo
will be availableadapt
- whether we can adapt the mapping or schema- Returns:
- the strategy alias or a strategy instance, or null
-
getTableName
Description copied from interface:MappingDefaults
Return the default table name for the given class. This method is only called for classes mapped to their own table.- Specified by:
getTableName
in interfaceMappingDefaults
- Overrides:
getTableName
in classMappingDefaultsImpl
-
getTableName
Description copied from interface:MappingDefaults
Return the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.- Specified by:
getTableName
in interfaceMappingDefaults
- Overrides:
getTableName
in classMappingDefaultsImpl
-
getTableIdentifier
Description copied from interface:MappingDefaults
Return the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.- Specified by:
getTableIdentifier
in interfaceMappingDefaults
- Overrides:
getTableIdentifier
in classMappingDefaultsImpl
-
populateJoinColumn
public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols) Description copied from interface:MappingDefaults
Fill in default information for the given column used to join a field to its defining class' table. The column will be a clone of the target column, or have its name and Java type set in the case of a constant target.- Specified by:
populateJoinColumn
in interfaceMappingDefaults
- Overrides:
populateJoinColumn
in classMappingDefaultsImpl
target
- the target of this column in the join; may be another column or a constant valuepos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign key
-
populateForeignKeyColumn
public void populateForeignKeyColumn(ValueMapping vm, String name, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols) Description copied from interface:MappingDefaults
Fill in default information for the given column used to join a value to its related type. The column will be a clone of the target column, or have its name and Java type set in the case of a constant target.- Specified by:
populateForeignKeyColumn
in interfaceMappingDefaults
- Overrides:
populateForeignKeyColumn
in classMappingDefaultsImpl
name
- base name for value, as decided by mappingtarget
- the target of this column in the join; may be another column or a constant valueinverse
- whether this is an inverse foreign keypos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign key
-
populateForeignKeyColumn
public void populateForeignKeyColumn(ValueMapping vm, DBIdentifier sName, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols) Description copied from interface:MappingDefaults
Fill in default information for the given column used to join a value to its related type. The column will be a clone of the target column, or have its name and Java type set in the case of a constant target.- Specified by:
populateForeignKeyColumn
in interfaceMappingDefaults
- Overrides:
populateForeignKeyColumn
in classMappingDefaultsImpl
sName
- base name for value, as decided by mappingtarget
- the target of this column in the join; may be another column or a constant valueinverse
- whether this is an inverse foreign keypos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign key
-
populateColumns
Description copied from interface:MappingDefaults
Fill in default information for the given version columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Specified by:
populateColumns
in interfaceMappingDefaults
- Overrides:
populateColumns
in classMappingDefaultsImpl
-