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:
java.io.Serializable
,ValueMapping
,MetaDataContext
,MetaDataModes
,ValueMetaData
public class ValueMappingImpl extends ValueMetaDataImpl implements ValueMapping
StandaloneValueMapping
implementation.- Since:
- 0.4.0
- Author:
- Abe White
- See Also:
- Serialized Form
-
-
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
Constructors Modifier Constructor Description protected
ValueMappingImpl()
Constructor for deserialization.ValueMappingImpl(FieldMapping owner)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clearMapping()
Clear mapping information, including strategy.void
copy(ValueMetaData vmd)
Copy state from the given value to this one.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.ForeignKey
getForeignKey(ClassMapping target, int targetNumber)
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.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
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 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
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 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 Detail
-
ValueMappingImpl
public ValueMappingImpl(FieldMapping owner)
Constructor. Supply owning mapping.
-
ValueMappingImpl
protected ValueMappingImpl()
Constructor for deserialization.
-
-
Method Detail
-
getValueInfo
public ValueMappingInfo getValueInfo()
Description copied from interface:ValueMapping
Raw mapping data.- Specified by:
getValueInfo
in interfaceValueMapping
-
getHandler
public ValueHandler getHandler()
Description copied from interface:ValueMapping
The handler used for this value, or null if none.- Specified by:
getHandler
in interfaceValueMapping
-
setHandler
public void setHandler(ValueHandler handler)
Description copied from interface:ValueMapping
The handler used for this value, or null if none.- Specified by:
setHandler
in interfaceValueMapping
-
getMappingRepository
public MappingRepository getMappingRepository()
Description copied from interface:ValueMapping
Convenience method to perform cast fromMetaDataContext.getRepository()
.- Specified by:
getMappingRepository
in interfaceValueMapping
-
getFieldMapping
public FieldMapping getFieldMapping()
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getFieldMetaData()
.- Specified by:
getFieldMapping
in interfaceValueMapping
-
getTypeMapping
public ClassMapping getTypeMapping()
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getTypeMetaData()
.- Specified by:
getTypeMapping
in interfaceValueMapping
-
getDeclaredTypeMapping
public ClassMapping getDeclaredTypeMapping()
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData()
.- Specified by:
getDeclaredTypeMapping
in interfaceValueMapping
-
getEmbeddedMapping
public ClassMapping getEmbeddedMapping()
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData()
.- Specified by:
getEmbeddedMapping
in interfaceValueMapping
-
getValueMappedByMapping
public FieldMapping getValueMappedByMapping()
Description copied from interface:ValueMapping
Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData()
.- Specified by:
getValueMappedByMapping
in interfaceValueMapping
-
getColumns
public Column[] getColumns()
Description copied from interface:ValueMapping
The columns that hold the data for this value.- Specified by:
getColumns
in interfaceValueMapping
-
setColumns
public void setColumns(Column[] cols)
Description copied from interface:ValueMapping
The columns that hold the data for this value.- Specified by:
setColumns
in interfaceValueMapping
-
getColumnIO
public ColumnIO 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
public void setColumnIO(ColumnIO io)
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
public ForeignKey getForeignKey()
Description copied from interface:ValueMapping
If this value joins to another record, the foreign key.- Specified by:
getForeignKey
in interfaceValueMapping
-
setForeignKey
public void setForeignKey(ForeignKey fk)
Description copied from interface:ValueMapping
If this value joins to another record, the foreign key.- Specified by:
setForeignKey
in interfaceValueMapping
-
getForeignKey
public ForeignKey getForeignKey(ClassMapping target, int targetNumber)
-
getForeignKey
public ForeignKey getForeignKey(ClassMapping target)
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
public void setForeignKey(Row row, OpenJPAStateManager rel, int targetNumber) throws java.sql.SQLException
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:
java.sql.SQLException
-
setForeignKey
public void setForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
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:
java.sql.SQLException
-
whereForeignKey
public void whereForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
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:
java.sql.SQLException
-
getIndependentTypeMappings
public ClassMapping[] 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
public Unique getValueUnique()
Description copied from interface:ValueMapping
Unique constraint on this value's columns, or null if none.- Specified by:
getValueUnique
in interfaceValueMapping
-
setValueUnique
public void setValueUnique(Unique unq)
Description copied from interface:ValueMapping
Unique constraint on this value's columns, or null if none.- Specified by:
setValueUnique
in interfaceValueMapping
-
getValueIndex
public Index getValueIndex()
Description copied from interface:ValueMapping
Index on this value's columns, or null if none.- Specified by:
getValueIndex
in interfaceValueMapping
-
setValueIndex
public void setValueIndex(Index idx)
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 public void mapConstraints(java.lang.String name, boolean adapt)
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
public void mapConstraints(DBIdentifier name, boolean adapt)
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
public void copy(ValueMetaData vmd)
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
public void copyMappingInfo(ValueMapping vm)
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
-
-