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
  • 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

      public Object getStrategy(Version vers, boolean adapt)
      Description copied from interface: MappingDefaults
      Default version mapping strategy when there is no explicit strategy.
      Specified by:
      getStrategy in interface MappingDefaults
      Overrides:
      getStrategy in class MappingDefaultsImpl
      Parameters:
      vers - the version; will not be mapped, but raw MappingInfo will be available
      adapt - whether we can adapt the mapping or schema
      Returns:
      the strategy alias or a strategy instance, or null
    • getStrategy

      public Object getStrategy(Discriminator disc, boolean adapt)
      Description copied from interface: MappingDefaults
      Default discriminator mapping strategy when there is no explicit strategy.
      Specified by:
      getStrategy in interface MappingDefaults
      Overrides:
      getStrategy in class MappingDefaultsImpl
      Parameters:
      disc - the discriminator; will not be mapped, but raw MappingInfo will be available
      adapt - whether we can adapt the mapping or schema
      Returns:
      the strategy alias or a strategy instance, or null
    • getTableName

      public String getTableName(ClassMapping cls, Schema schema)
      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 interface MappingDefaults
      Overrides:
      getTableName in class MappingDefaultsImpl
    • getTableName

      public String getTableName(FieldMapping fm, Schema schema)
      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 interface MappingDefaults
      Overrides:
      getTableName in class MappingDefaultsImpl
    • getTableIdentifier

      public DBIdentifier getTableIdentifier(FieldMapping fm, Schema schema)
      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 interface MappingDefaults
      Overrides:
      getTableIdentifier in class MappingDefaultsImpl
    • 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 interface MappingDefaults
      Overrides:
      populateJoinColumn in class MappingDefaultsImpl
      target - the target of this column in the join; may be another column or a constant value
      pos - the index of this column in the logical foreign key
      cols - 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 interface MappingDefaults
      Overrides:
      populateForeignKeyColumn in class MappingDefaultsImpl
      name - base name for value, as decided by mapping
      target - the target of this column in the join; may be another column or a constant value
      inverse - whether this is an inverse foreign key
      pos - the index of this column in the logical foreign key
      cols - 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 interface MappingDefaults
      Overrides:
      populateForeignKeyColumn in class MappingDefaultsImpl
      sName - base name for value, as decided by mapping
      target - the target of this column in the join; may be another column or a constant value
      inverse - whether this is an inverse foreign key
      pos - the index of this column in the logical foreign key
      cols - the number of columns in the logical foreign key
    • populateColumns

      public void populateColumns(Version vers, Table table, Column[] cols)
      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 interface MappingDefaults
      Overrides:
      populateColumns in class MappingDefaultsImpl