Package org.apache.openjpa.jdbc.meta
Class ValueMappingImpl
java.lang.Object
org.apache.openjpa.meta.ValueMetaDataImpl
org.apache.openjpa.jdbc.meta.ValueMappingImpl
- All Implemented Interfaces:
Serializable
,ValueMapping
,MetaDataContext
,MetaDataModes
,ValueMetaData
Standalone
ValueMapping
implementation.- Since:
- 0.4.0
- Author:
- Abe White
- See Also:
-
Field Summary
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.jdbc.meta.ValueMapping
JOIN_EXPECTED_INVERSE, JOIN_FORWARD, JOIN_INVERSE, POLY_FALSE, POLY_JOINABLE, POLY_TRUE
Fields inherited from interface org.apache.openjpa.meta.ValueMetaData
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor for deserialization.ValueMappingImpl
(FieldMapping owner) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear mapping information, including strategy.void
copy
(ValueMetaData vmd) Copy state from the given value to this one.void
Copy mapping info from the given instance to this one.I/O information on the foreign key, or columns if this value doesn't have a key.Column[]
The columns that hold the data for this value.Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData()
.Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData()
.Convenience method to perform cast fromValueMetaData.getFieldMetaData()
.If this value joins to another record, the foreign key.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.getForeignKey
(ClassMapping target, int targetNumber) The handler used for this value, or null if none.Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped.int
The join direction.Convenience method to perform cast fromMetaDataContext.getRepository()
.int
The degree to which this relation is polymorphic.int
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.Convenience method to perform cast fromValueMetaData.getTypeMetaData()
.boolean
Whether to use class criteria when joining to related type.Index on this value's columns, or null if none.Raw mapping data.Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData()
.Unique constraint on this value's columns, or null if none.void
mapConstraints
(String name, boolean adapt) Deprecated.void
mapConstraints
(DBIdentifier name, boolean adapt) Map indexes and constraints for this value, using the currentValueMappingInfo
.void
Increase the reference count on used schema components.boolean
resolve
(int mode) Resolve and validate metadata.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
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 poly) 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
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 class org.apache.openjpa.meta.ValueMetaDataImpl
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getRepository, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.openjpa.meta.MetaDataContext
getRepository
Methods inherited from interface org.apache.openjpa.meta.ValueMetaData
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy
-
Constructor Details
-
ValueMappingImpl
Constructor. Supply owning mapping. -
ValueMappingImpl
protected ValueMappingImpl()Constructor for deserialization.
-
-
Method Details
-
getValueInfo
Description copied from interface:ValueMapping
Raw mapping data.- Specified by:
getValueInfo
in interfaceValueMapping
-
getHandler
Description copied from interface:ValueMapping
The handler used for this value, or null if none.- Specified by:
getHandler
in interfaceValueMapping
-
setHandler
Description copied from interface:ValueMapping
The handler used for this value, or null if none.- Specified by:
setHandler
in interfaceValueMapping
-
getMappingRepository
Description copied from interface:ValueMapping
Convenience method to perform cast fromMetaDataContext.getRepository()
.- Specified by:
getMappingRepository
in interfaceValueMapping
-
getFieldMapping
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getFieldMetaData()
.- Specified by:
getFieldMapping
in interfaceValueMapping
-
getTypeMapping
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getTypeMetaData()
.- Specified by:
getTypeMapping
in interfaceValueMapping
-
getDeclaredTypeMapping
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData()
.- Specified by:
getDeclaredTypeMapping
in interfaceValueMapping
-
getEmbeddedMapping
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData()
.- Specified by:
getEmbeddedMapping
in interfaceValueMapping
-
getValueMappedByMapping
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData()
.- Specified by:
getValueMappedByMapping
in interfaceValueMapping
-
getColumns
Description copied from interface:ValueMapping
The columns that hold the data for this value.- Specified by:
getColumns
in interfaceValueMapping
-
setColumns
Description copied from interface:ValueMapping
The columns that hold the data for this value.- Specified by:
setColumns
in interfaceValueMapping
-
getColumnIO
Description copied from interface:ValueMapping
I/O information on the foreign key, or columns if this value doesn't have a key.- Specified by:
getColumnIO
in interfaceValueMapping
-
setColumnIO
Description copied from interface:ValueMapping
I/O information on the foreign key, or columns if this value doesn't have a key.- Specified by:
setColumnIO
in interfaceValueMapping
-
getForeignKey
Description copied from interface:ValueMapping
If this value joins to another record, the foreign key.- Specified by:
getForeignKey
in interfaceValueMapping
-
setForeignKey
Description copied from interface:ValueMapping
If this value joins to another record, the foreign key.- Specified by:
setForeignKey
in interfaceValueMapping
-
getForeignKey
-
getForeignKey
Description copied from interface:ValueMapping
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.- Specified by:
getForeignKey
in interfaceValueMapping
-
getJoinDirection
public int getJoinDirection()Description copied from interface:ValueMapping
The join direction.- Specified by:
getJoinDirection
in interfaceValueMapping
-
setJoinDirection
public void setJoinDirection(int direction) Description copied from interface:ValueMapping
The join direction.- Specified by:
setJoinDirection
in interfaceValueMapping
-
setForeignKey
Description copied from interface:ValueMapping
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.- Specified by:
setForeignKey
in interfaceValueMapping
- Throws:
SQLException
-
setForeignKey
Description copied from interface:ValueMapping
Sets this value's foreign key to the given related object. The object may be null.- Specified by:
setForeignKey
in interfaceValueMapping
- Throws:
SQLException
-
whereForeignKey
Description copied from interface:ValueMapping
Sets this value's foreign key to the given related object. The object may be null.- Specified by:
whereForeignKey
in interfaceValueMapping
- Throws:
SQLException
-
getIndependentTypeMappings
Description copied from interface:ValueMapping
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.- Specified by:
getIndependentTypeMappings
in interfaceValueMapping
-
getSelectSubclasses
public int getSelectSubclasses()Description copied from interface:ValueMapping
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.- Specified by:
getSelectSubclasses
in interfaceValueMapping
-
getValueUnique
Description copied from interface:ValueMapping
Unique constraint on this value's columns, or null if none.- Specified by:
getValueUnique
in interfaceValueMapping
-
setValueUnique
Description copied from interface:ValueMapping
Unique constraint on this value's columns, or null if none.- Specified by:
setValueUnique
in interfaceValueMapping
-
getValueIndex
Description copied from interface:ValueMapping
Index on this value's columns, or null if none.- Specified by:
getValueIndex
in interfaceValueMapping
-
setValueIndex
Description copied from interface:ValueMapping
Index on this value's columns, or null if none.- Specified by:
setValueIndex
in interfaceValueMapping
-
getUseClassCriteria
public boolean getUseClassCriteria()Description copied from interface:ValueMapping
Whether to use class criteria when joining to related type.- Specified by:
getUseClassCriteria
in interfaceValueMapping
-
setUseClassCriteria
public void setUseClassCriteria(boolean criteria) Description copied from interface:ValueMapping
Whether to use class criteria when joining to related type.- Specified by:
setUseClassCriteria
in interfaceValueMapping
-
getPolymorphic
public int getPolymorphic()Description copied from interface:ValueMapping
The degree to which this relation is polymorphic.- Specified by:
getPolymorphic
in interfaceValueMapping
-
setPolymorphic
public void setPolymorphic(int poly) Description copied from interface:ValueMapping
The degree to which this relation is polymorphic.- Specified by:
setPolymorphic
in interfaceValueMapping
-
refSchemaComponents
public void refSchemaComponents()Description copied from interface:ValueMapping
Increase the reference count on used schema components.- Specified by:
refSchemaComponents
in interfaceValueMapping
-
mapConstraints
Deprecated.Description copied from interface:ValueMapping
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.- Specified by:
mapConstraints
in interfaceValueMapping
-
mapConstraints
Description copied from interface:ValueMapping
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.- Specified by:
mapConstraints
in interfaceValueMapping
-
clearMapping
public void clearMapping()Description copied from interface:ValueMapping
Clear mapping information, including strategy.- Specified by:
clearMapping
in interfaceValueMapping
-
syncMappingInfo
public void syncMappingInfo()Description copied from interface:ValueMapping
UpdateMappingInfo
with our current mapping information.- Specified by:
syncMappingInfo
in interfaceValueMapping
-
copy
Description copied from interface:ValueMetaData
Copy state from the given value to this one. Do not copy mapping information.- Specified by:
copy
in interfaceValueMetaData
- Overrides:
copy
in classValueMetaDataImpl
-
copyMappingInfo
Description copied from interface:ValueMapping
Copy mapping info from the given instance to this one.- Specified by:
copyMappingInfo
in interfaceValueMapping
-
resolve
public boolean resolve(int mode) Description copied from interface:ValueMetaData
Resolve and validate metadata. Return true if already resolved.- Specified by:
resolve
in interfaceValueMetaData
- Overrides:
resolve
in classValueMetaDataImpl
-