Class PersistenceMappingDefaults
- java.lang.Object
-
- org.apache.openjpa.jdbc.meta.MappingDefaultsImpl
-
- org.apache.openjpa.persistence.jdbc.PersistenceMappingDefaults
-
- All Implemented Interfaces:
MappingDefaults,Configurable
public class PersistenceMappingDefaults extends MappingDefaultsImpl
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
Constructors Constructor Description PersistenceMappingDefaults()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetPrependFieldNameToJoinTableInverseJoinColumns()Whether to prepend the field name to the default name of inverse join columns within join tables.java.lang.ObjectgetStrategy(Discriminator disc, boolean adapt)Default discriminator mapping strategy when there is no explicit strategy.java.lang.ObjectgetStrategy(Version vers, boolean adapt)Default version mapping strategy when there is no explicit strategy.DBIdentifiergetTableIdentifier(FieldMapping fm, Schema schema)Return the default secondary table name for the given field.java.lang.StringgetTableName(ClassMapping cls, Schema schema)Return the default table name for the given class.java.lang.StringgetTableName(FieldMapping fm, Schema schema)Return the default secondary table name for the given field.voidpopulateColumns(Version vers, Table table, Column[] cols)Fill in default information for the given version columns.voidpopulateForeignKeyColumn(ValueMapping vm, java.lang.String name, Table local, Table foreign, Column col, java.lang.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.voidpopulateForeignKeyColumn(ValueMapping vm, DBIdentifier sName, Table local, Table foreign, Column col, java.lang.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.voidpopulateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, java.lang.Object target, int pos, int cols)Fill in default information for the given column used to join a field to its defining class' table.voidsetPrependFieldNameToJoinTableInverseJoinColumns(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
-
-
-
-
Method Detail
-
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
public java.lang.Object getStrategy(Version vers, boolean adapt)
Description copied from interface:MappingDefaultsDefault version mapping strategy when there is no explicit strategy.- Specified by:
getStrategyin interfaceMappingDefaults- Overrides:
getStrategyin classMappingDefaultsImpl- Parameters:
vers- the version; will not be mapped, but rawMappingInfowill be availableadapt- whether we can adapt the mapping or schema- Returns:
- the strategy alias or a strategy instance, or null
-
getStrategy
public java.lang.Object getStrategy(Discriminator disc, boolean adapt)
Description copied from interface:MappingDefaultsDefault discriminator mapping strategy when there is no explicit strategy.- Specified by:
getStrategyin interfaceMappingDefaults- Overrides:
getStrategyin classMappingDefaultsImpl- Parameters:
disc- the discriminator; will not be mapped, but rawMappingInfowill be availableadapt- whether we can adapt the mapping or schema- Returns:
- the strategy alias or a strategy instance, or null
-
getTableName
public java.lang.String getTableName(ClassMapping cls, Schema schema)
Description copied from interface:MappingDefaultsReturn the default table name for the given class. This method is only called for classes mapped to their own table.- Specified by:
getTableNamein interfaceMappingDefaults- Overrides:
getTableNamein classMappingDefaultsImpl
-
getTableName
public java.lang.String getTableName(FieldMapping fm, Schema schema)
Description copied from interface:MappingDefaultsReturn the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.- Specified by:
getTableNamein interfaceMappingDefaults- Overrides:
getTableNamein classMappingDefaultsImpl
-
getTableIdentifier
public DBIdentifier getTableIdentifier(FieldMapping fm, Schema schema)
Description copied from interface:MappingDefaultsReturn the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.- Specified by:
getTableIdentifierin interfaceMappingDefaults- Overrides:
getTableIdentifierin classMappingDefaultsImpl
-
populateJoinColumn
public void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, java.lang.Object target, int pos, int cols)
Description copied from interface:MappingDefaultsFill 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:
populateJoinColumnin interfaceMappingDefaults- Overrides:
populateJoinColumnin classMappingDefaultsImpltarget- 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, java.lang.String name, Table local, Table foreign, Column col, java.lang.Object target, boolean inverse, int pos, int cols)
Description copied from interface:MappingDefaultsFill 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:
populateForeignKeyColumnin interfaceMappingDefaults- Overrides:
populateForeignKeyColumnin classMappingDefaultsImplname- 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, java.lang.Object target, boolean inverse, int pos, int cols)
Description copied from interface:MappingDefaultsFill 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:
populateForeignKeyColumnin interfaceMappingDefaults- Overrides:
populateForeignKeyColumnin classMappingDefaultsImplsName- 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
public void populateColumns(Version vers, Table table, Column[] cols)
Description copied from interface:MappingDefaultsFill 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:
populateColumnsin interfaceMappingDefaults- Overrides:
populateColumnsin classMappingDefaultsImpl
-
-