Package org.apache.openjpa.jdbc.meta
Interface MappingDefaults
-
- All Known Implementing Classes:
MappingDefaultsImpl
,NoneMappingDefaults
,PersistenceMappingDefaults
public interface MappingDefaults
Generates default names for tables, columns, indexes, constraints, etc.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
defaultMissingInfo()
Whether to fill in missing mapping information at runtime with the default values supplied by this plugin.java.lang.Object
getDiscriminatorValue(Discriminator disc, boolean adapt)
Return the default discriminator value for the given instance.ForeignKey
getForeignKey(ValueMapping vm, java.lang.String name, Table local, Table foreign, boolean inverse)
Deprecated.ForeignKey
getForeignKey(ValueMapping vm, DBIdentifier name, Table local, Table foreign, boolean inverse)
Return a default foreign key for the join from this value to its related type, or null for a logical foreign key only.Index
getIndex(Discriminator disc, Table table, Column[] cols)
Return a default index for the discriminator, or null if the discriminator columns should not be indexed by default.Index
getIndex(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Index
getIndex(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Return a default index for the value, or null if the value columns should not be indexed by default.Index
getIndex(Version vers, Table table, Column[] cols)
Return a default index for the version, or null if the version columns should not be indexed by default.ForeignKey
getJoinForeignKey(ClassMapping cls, Table local, Table foreign)
Return a default foreign key for the join from this class' table to its superclass' table, or null for a logical foreign key only.ForeignKey
getJoinForeignKey(FieldMapping fm, Table local, Table foreign)
Return a default foreign key for the join from this field's table to its defining class' table, or null for a logical foreign key only.Index
getJoinIndex(FieldMapping fm, Table table, Column[] cols)
Return a default index for the join, or null if the join columns should not be indexed by default.Unique
getJoinUnique(FieldMapping fm, Table table, Column[] cols)
Return a default constraint for the join, or null if the join columns should not be constrained by default.DBIdentifier
getPrimaryKeyIdentifier(ClassMapping cm, Table table)
Return the name of the primary key for the table of the given class, or null for database default.java.lang.String
getPrimaryKeyName(ClassMapping cm, Table table)
Deprecated.java.lang.Object
getStrategy(ClassMapping cls, boolean adapt)
Default mapping strategy when there is no explicit strategy and no hierarchy strategy given.java.lang.Object
getStrategy(Discriminator disc, boolean adapt)
Default discriminator mapping strategy when there is no explicit strategy.java.lang.Object
getStrategy(ValueMapping vm, java.lang.Class<?> type, boolean adapt)
Custom handler or strategy for the given field, or null if none has been registered.java.lang.Object
getStrategy(Version vers, boolean adapt)
Default version mapping strategy when there is no explicit strategy.DBIdentifier
getTableIdentifier(ClassMapping cls, Schema defaultSchema)
Return the default table name for the given class.DBIdentifier
getTableIdentifier(FieldMapping fm, Schema defaultSchema)
Return the default secondary table name for the given field.java.lang.String
getTableName(ClassMapping cls, Schema defaultSchema)
Deprecated.java.lang.String
getTableName(FieldMapping fm, Schema defaultSchema)
Deprecated.Unique
getUnique(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Unique
getUnique(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Return a default constraint for the value, or null if the value columns should not be constrained by default.void
installPrimaryKey(FieldMapping fm, Table table)
If desired, install a primary key on the given secondary table.void
populateColumns(Discriminator disc, Table table, Column[] cols)
Fill in default information for the given discriminator columns.void
populateColumns(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.void
populateColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Fill in default information for the given value columns.void
populateColumns(Version vers, Table table, Column[] cols)
Fill in default information for the given version columns.void
populateDataStoreIdColumns(ClassMapping cls, Table table, Column[] cols)
Fill in default information for the given datastore identity columns.void
populateForeignKeyColumn(ValueMapping vm, java.lang.String name, Table local, Table foreign, Column col, java.lang.Object target, boolean inverse, int pos, int cols)
Deprecated.void
populateForeignKeyColumn(ValueMapping vm, DBIdentifier 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.void
populateJoinColumn(ClassMapping cm, 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 class to its superclass table.void
populateJoinColumn(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.boolean
populateNullIndicatorColumns(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.boolean
populateNullIndicatorColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Fill in default information for the given null indicator columns.boolean
populateOrderColumns(FieldMapping fm, Table table, Column[] cols)
Fill in default information for the given order columns.boolean
useClassCriteria()
The default for whether relations use the related object's expected class as part of the join criteria.
-
-
-
Method Detail
-
defaultMissingInfo
boolean defaultMissingInfo()
Whether to fill in missing mapping information at runtime with the default values supplied by this plugin. A value of false means that all mapping information must be present at runtime.
-
useClassCriteria
boolean useClassCriteria()
The default for whether relations use the related object's expected class as part of the join criteria.
-
getStrategy
java.lang.Object getStrategy(ClassMapping cls, boolean adapt)
Default mapping strategy when there is no explicit strategy and no hierarchy strategy given.- Parameters:
cls
- the class; will not be mapped, but superclass and rawMappingInfo
will be availableadapt
- whether we can adapt the mapping or schema- Returns:
- the strategy alias or a strategy instance, or null
-
getStrategy
java.lang.Object getStrategy(Version vers, boolean adapt)
Default version mapping strategy when there is no explicit strategy.- 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
java.lang.Object getStrategy(Discriminator disc, boolean adapt)
Default discriminator mapping strategy when there is no explicit strategy.- 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
-
getStrategy
java.lang.Object getStrategy(ValueMapping vm, java.lang.Class<?> type, boolean adapt)
Custom handler or strategy for the given field, or null if none has been registered.- Parameters:
vm
- the value mapping; will not be mapped, but rawMappingInfo
will be availabletype
- the value typeadapt
- whether we can adapt the mapping or schema- Returns:
- the handler/strategy alias or instance, or null
-
getDiscriminatorValue
java.lang.Object getDiscriminatorValue(Discriminator disc, boolean adapt)
Return the default discriminator value for the given instance.
-
getTableName
@Deprecated java.lang.String getTableName(ClassMapping cls, Schema defaultSchema)
Deprecated.Return the default table name for the given class. This method is only called for classes mapped to their own table.
-
getTableIdentifier
DBIdentifier getTableIdentifier(ClassMapping cls, Schema defaultSchema)
Return the default table name for the given class. This method is only called for classes mapped to their own table.
-
getTableName
@Deprecated java.lang.String getTableName(FieldMapping fm, Schema defaultSchema)
Deprecated.Return the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.
-
getTableIdentifier
DBIdentifier getTableIdentifier(FieldMapping fm, Schema defaultSchema)
Return the default secondary table name for the given field. This method is only called for fields whose strategy requires a secondary table.
-
populateDataStoreIdColumns
void populateDataStoreIdColumns(ClassMapping cls, Table table, Column[] cols)
Fill in default information for the given datastore identity columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.
-
populateColumns
void populateColumns(Version vers, Table table, Column[] cols)
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.
-
populateColumns
void populateColumns(Discriminator disc, Table table, Column[] cols)
Fill in default information for the given discriminator columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.
-
populateJoinColumn
void populateJoinColumn(ClassMapping cm, 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 class to its superclass 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.- Parameters:
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
-
populateJoinColumn
void populateJoinColumn(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. 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.- Parameters:
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
@Deprecated void populateForeignKeyColumn(ValueMapping vm, java.lang.String name, Table local, Table foreign, Column col, java.lang.Object target, boolean inverse, int pos, int cols)
Deprecated.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.- Parameters:
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
void populateForeignKeyColumn(ValueMapping vm, DBIdentifier 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. 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.- Parameters:
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
-
populateColumns
@Deprecated void populateColumns(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Fill in default information for the given value columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Parameters:
name
- base name for value, as decided by mapping
-
populateColumns
void populateColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Fill in default information for the given value columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Parameters:
name
- base name for value, as decided by mapping
-
populateOrderColumns
boolean populateOrderColumns(FieldMapping fm, Table table, Column[] cols)
Fill in default information for the given order columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Returns:
- false if the given field should not have order columns by default; fill in default information even when returning false in case the user forces ordering
-
populateNullIndicatorColumns
@Deprecated boolean populateNullIndicatorColumns(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Fill in default information for the given null indicator columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Parameters:
name
- base name for value, as decided by mapping- Returns:
- false if the given value should not have null indicator columns by default; fill in default information even when returning false in case the user forces an indicator
-
populateNullIndicatorColumns
boolean populateNullIndicatorColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Fill in default information for the given null indicator columns. The columns' name and Java type will already be populated with generic defaults that may be replaced.- Parameters:
name
- base name for value, as decided by mapping- Returns:
- false if the given value should not have null indicator columns by default; fill in default information even when returning false in case the user forces an indicator
-
getJoinForeignKey
ForeignKey getJoinForeignKey(ClassMapping cls, Table local, Table foreign)
Return a default foreign key for the join from this class' table to its superclass' table, or null for a logical foreign key only. Do not add columns to the key or add the key to the table; only fill in its information such as name, delete action, etc.
-
getJoinForeignKey
ForeignKey getJoinForeignKey(FieldMapping fm, Table local, Table foreign)
Return a default foreign key for the join from this field's table to its defining class' table, or null for a logical foreign key only. Do not add columns to the key or add the key to the table; only fill in its information such as name, delete action, etc.
-
getForeignKey
@Deprecated ForeignKey getForeignKey(ValueMapping vm, java.lang.String name, Table local, Table foreign, boolean inverse)
Deprecated.Return a default foreign key for the join from this value to its related type, or null for a logical foreign key only. Do not add columns to the key or add the key to the table; only fill in its information such as name, delete action, etc.- Parameters:
name
- base name for value, as decided by mappinginverse
- whether this is an inverse key
-
getForeignKey
ForeignKey getForeignKey(ValueMapping vm, DBIdentifier name, Table local, Table foreign, boolean inverse)
Return a default foreign key for the join from this value to its related type, or null for a logical foreign key only. Do not add columns to the key or add the key to the table; only fill in its information such as name, delete action, etc.- Parameters:
name
- base name for value, as decided by mappinginverse
- whether this is an inverse key
-
getJoinIndex
Index getJoinIndex(FieldMapping fm, Table table, Column[] cols)
Return a default index for the join, or null if the join columns should not be indexed by default. Do not add columns to the index or add the index to the table; only fill in its information such as name, uniqueness, etc.
-
getIndex
@Deprecated Index getIndex(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Return a default index for the value, or null if the value columns should not be indexed by default. Do not add columns to the index or add the index to the table; only fill in its information such as name, uniqueness, etc.- Parameters:
name
- base name for value, as decided by mapping
-
getIndex
Index getIndex(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Return a default index for the value, or null if the value columns should not be indexed by default. Do not add columns to the index or add the index to the table; only fill in its information such as name, uniqueness, etc.- Parameters:
name
- base name for value, as decided by mapping
-
getIndex
Index getIndex(Version vers, Table table, Column[] cols)
Return a default index for the version, or null if the version columns should not be indexed by default. Do not add columns to the index or add the index to the table; only fill in its information such as name, uniqueness, etc.
-
getIndex
Index getIndex(Discriminator disc, Table table, Column[] cols)
Return a default index for the discriminator, or null if the discriminator columns should not be indexed by default. Do not add columns to the index or add the index to the table; only fill in its information such as name, uniqueness, etc.
-
getJoinUnique
Unique getJoinUnique(FieldMapping fm, Table table, Column[] cols)
Return a default constraint for the join, or null if the join columns should not be constrained by default. Do not add columns to the constraint or add the constraint to the table; only fill in its information such as name, deferrability, etc.
-
getUnique
@Deprecated Unique getUnique(ValueMapping vm, java.lang.String name, Table table, Column[] cols)
Deprecated.Return a default constraint for the value, or null if the value columns should not be constrained by default. Do not add columns to the constraint or add the constraint to the table; only fill in its information such as name, deferrability, etc.- Parameters:
name
- base name for value, as decided by mapping
-
getUnique
Unique getUnique(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
Return a default constraint for the value, or null if the value columns should not be constrained by default. Do not add columns to the constraint or add the constraint to the table; only fill in its information such as name, deferrability, etc.- Parameters:
name
- base name for value, as decided by mapping
-
getPrimaryKeyName
@Deprecated java.lang.String getPrimaryKeyName(ClassMapping cm, Table table)
Deprecated.Return the name of the primary key for the table of the given class, or null for database default.
-
getPrimaryKeyIdentifier
DBIdentifier getPrimaryKeyIdentifier(ClassMapping cm, Table table)
Return the name of the primary key for the table of the given class, or null for database default.
-
installPrimaryKey
void installPrimaryKey(FieldMapping fm, Table table)
If desired, install a primary key on the given secondary table.
-
-