Package org.apache.openjpa.jdbc.meta
Interface ValueMapping
-
- All Superinterfaces:
MetaDataContext
,MetaDataModes
,java.io.Serializable
,ValueMetaData
- All Known Implementing Classes:
FieldMapping
,ValueMappingImpl
public interface ValueMapping extends ValueMetaData, MetaDataContext, java.io.Serializable
Specialization of value metadata for relational databases.- Since:
- 0.4.0
- Author:
- Abe White
-
-
Field Summary
Fields Modifier and Type Field Description static int
JOIN_EXPECTED_INVERSE
Inverse join that is marked up as a forward join because the backing mapping expects an inverse direction.static int
JOIN_FORWARD
Standard forward join.static int
JOIN_INVERSE
Inverse join.static int
POLY_FALSE
A non-polymorphic relation.static int
POLY_JOINABLE
A relation that can hold any joinable subclass type.static int
POLY_TRUE
A fully polymorphic relation (the default).-
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
-
Fields inherited from interface org.apache.openjpa.meta.ValueMetaData
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
clearMapping()
Clear mapping information, including strategy.void
copyMappingInfo(ValueMapping vm)
Copy mapping info from the given instance to this one.ColumnIO
getColumnIO()
I/O information on the foreign key, or columns if this value doesn't have a key.Column[]
getColumns()
The columns that hold the data for this value.ClassMapping
getDeclaredTypeMapping()
Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData()
.ClassMapping
getEmbeddedMapping()
Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData()
.FieldMapping
getFieldMapping()
Convenience method to perform cast fromValueMetaData.getFieldMetaData()
.ForeignKey
getForeignKey()
If this value joins to another record, the foreign key.ForeignKey
getForeignKey(ClassMapping target)
Return an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.ValueHandler
getHandler()
The handler used for this value, or null if none.ClassMapping[]
getIndependentTypeMappings()
Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped.int
getJoinDirection()
The join direction.MappingRepository
getMappingRepository()
Convenience method to perform cast fromMetaDataContext.getRepository()
.int
getPolymorphic()
The degree to which this relation is polymorphic.int
getSelectSubclasses()
Return theorg.apache.openjpa.sql.Select
subclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.ClassMapping
getTypeMapping()
Convenience method to perform cast fromValueMetaData.getTypeMetaData()
.boolean
getUseClassCriteria()
Whether to use class criteria when joining to related type.Index
getValueIndex()
Index on this value's columns, or null if none.ValueMappingInfo
getValueInfo()
Raw mapping data.FieldMapping
getValueMappedByMapping()
Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData()
.Unique
getValueUnique()
Unique constraint on this value's columns, or null if none.void
mapConstraints(java.lang.String name, boolean adapt)
Deprecated.void
mapConstraints(DBIdentifier name, boolean adapt)
Map indexes and constraints for this value, using the currentValueMappingInfo
.void
refSchemaComponents()
Increase the reference count on used schema components.void
setColumnIO(ColumnIO io)
I/O information on the foreign key, or columns if this value doesn't have a key.void
setColumns(Column[] cols)
The columns that hold the data for this value.void
setForeignKey(ForeignKey fk)
If this value joins to another record, the foreign key.void
setForeignKey(Row row, OpenJPAStateManager rel)
Sets this value's foreign key to the given related object.void
setForeignKey(Row row, OpenJPAStateManager rel, int targetNumber)
Sets this value's foreign key to the given related object.void
setHandler(ValueHandler handler)
The handler used for this value, or null if none.void
setJoinDirection(int direction)
The join direction.void
setPolymorphic(int polymorphic)
The degree to which this relation is polymorphic.void
setUseClassCriteria(boolean criteria)
Whether to use class criteria when joining to related type.void
setValueIndex(Index idx)
Index on this value's columns, or null if none.void
setValueUnique(Unique unq)
Unique constraint on this value's columns, or null if none.void
syncMappingInfo()
UpdateMappingInfo
with our current mapping information.void
whereForeignKey(Row row, OpenJPAStateManager rel)
Sets this value's foreign key to the given related object.-
Methods inherited from interface org.apache.openjpa.meta.MetaDataContext
getRepository
-
Methods inherited from interface org.apache.openjpa.meta.ValueMetaData
addEmbeddedMetaData, addEmbeddedMetaData, copy, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, resolve, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy
-
-
-
-
Field Detail
-
JOIN_FORWARD
static final int JOIN_FORWARD
Standard forward join.- See Also:
- Constant Field Values
-
JOIN_INVERSE
static final int JOIN_INVERSE
Inverse join.- See Also:
- Constant Field Values
-
JOIN_EXPECTED_INVERSE
static final int JOIN_EXPECTED_INVERSE
Inverse join that is marked up as a forward join because the backing mapping expects an inverse direction.- See Also:
- Constant Field Values
-
POLY_TRUE
static final int POLY_TRUE
A fully polymorphic relation (the default).- See Also:
- Constant Field Values
-
POLY_FALSE
static final int POLY_FALSE
A non-polymorphic relation.- See Also:
- Constant Field Values
-
POLY_JOINABLE
static final int POLY_JOINABLE
A relation that can hold any joinable subclass type.- See Also:
- Constant Field Values
-
-
Method Detail
-
getValueInfo
ValueMappingInfo getValueInfo()
Raw mapping data.
-
getHandler
ValueHandler getHandler()
The handler used for this value, or null if none.
-
setHandler
void setHandler(ValueHandler handler)
The handler used for this value, or null if none.
-
getMappingRepository
MappingRepository getMappingRepository()
Convenience method to perform cast fromMetaDataContext.getRepository()
.
-
getFieldMapping
FieldMapping getFieldMapping()
Convenience method to perform cast fromValueMetaData.getFieldMetaData()
.
-
getTypeMapping
ClassMapping getTypeMapping()
Convenience method to perform cast fromValueMetaData.getTypeMetaData()
.
-
getDeclaredTypeMapping
ClassMapping getDeclaredTypeMapping()
Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData()
.
-
getEmbeddedMapping
ClassMapping getEmbeddedMapping()
Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData()
.
-
getValueMappedByMapping
FieldMapping getValueMappedByMapping()
Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData()
.
-
getColumns
Column[] getColumns()
The columns that hold the data for this value.
-
setColumns
void setColumns(Column[] cols)
The columns that hold the data for this value.
-
getColumnIO
ColumnIO getColumnIO()
I/O information on the foreign key, or columns if this value doesn't have a key.
-
setColumnIO
void setColumnIO(ColumnIO io)
I/O information on the foreign key, or columns if this value doesn't have a key.
-
getForeignKey
ForeignKey getForeignKey()
If this value joins to another record, the foreign key.
-
getForeignKey
ForeignKey getForeignKey(ClassMapping target)
Return an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.
-
setForeignKey
void setForeignKey(ForeignKey fk)
If this value joins to another record, the foreign key.
-
getJoinDirection
int getJoinDirection()
The join direction.
-
setJoinDirection
void setJoinDirection(int direction)
The join direction.
-
setForeignKey
void setForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
Sets this value's foreign key to the given related object. The object may be null.- Throws:
java.sql.SQLException
-
setForeignKey
void setForeignKey(Row row, OpenJPAStateManager rel, int targetNumber) throws java.sql.SQLException
Sets this value's foreign key to the given related object. The object may be null. If the object is one of2or more foreign keys with the same target, the targetNumber specifies the one to set.- Throws:
java.sql.SQLException
-
whereForeignKey
void whereForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
Sets this value's foreign key to the given related object. The object may be null.- Throws:
java.sql.SQLException
-
getIndependentTypeMappings
ClassMapping[] getIndependentTypeMappings()
Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped. Return an empty array if value type is not PC.
-
getSelectSubclasses
int getSelectSubclasses()
Return theorg.apache.openjpa.sql.Select
subclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.
-
getValueUnique
Unique getValueUnique()
Unique constraint on this value's columns, or null if none.
-
setValueUnique
void setValueUnique(Unique unq)
Unique constraint on this value's columns, or null if none.
-
getValueIndex
Index getValueIndex()
Index on this value's columns, or null if none.
-
setValueIndex
void setValueIndex(Index idx)
Index on this value's columns, or null if none.
-
getUseClassCriteria
boolean getUseClassCriteria()
Whether to use class criteria when joining to related type.
-
setUseClassCriteria
void setUseClassCriteria(boolean criteria)
Whether to use class criteria when joining to related type.
-
getPolymorphic
int getPolymorphic()
The degree to which this relation is polymorphic.
-
setPolymorphic
void setPolymorphic(int polymorphic)
The degree to which this relation is polymorphic.
-
refSchemaComponents
void refSchemaComponents()
Increase the reference count on used schema components.
-
mapConstraints
@Deprecated void mapConstraints(java.lang.String name, boolean adapt)
Deprecated.Map indexes and constraints for this value, using the currentValueMappingInfo
. The foreign key or columns of this value must be set before calling this method.
-
mapConstraints
void mapConstraints(DBIdentifier name, boolean adapt)
Map indexes and constraints for this value, using the currentValueMappingInfo
. The foreign key or columns of this value must be set before calling this method.
-
clearMapping
void clearMapping()
Clear mapping information, including strategy.
-
syncMappingInfo
void syncMappingInfo()
UpdateMappingInfo
with our current mapping information.
-
copyMappingInfo
void copyMappingInfo(ValueMapping vm)
Copy mapping info from the given instance to this one.
-
-