public class FieldMapping extends FieldMetaData implements ValueMapping, FieldStrategy
FieldMetaData.MemberProvider
MANAGE_NONE, MANAGE_PERSISTENT, MANAGE_TRANSACTIONAL, MANY_TO_MANY, MANY_TO_ONE, NULL_DEFAULT, NULL_EXCEPTION, NULL_NONE, NULL_UNSET, ONE_TO_MANY, ONE_TO_ONE
OPENJPA
JOIN_EXPECTED_INVERSE, JOIN_FORWARD, JOIN_INVERSE, POLY_FALSE, POLY_JOINABLE, POLY_TRUE
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
EMPTY_COMMENTS
Constructor and Description |
---|
FieldMapping(String name,
Class<?> type,
ClassMapping owner)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
appendIndex(SQLBuffer sql,
Select sel,
Joins joins)
Append the ordered column alias to the given statement.
|
void |
appendIsEmpty(SQLBuffer sql,
Select sel,
Joins joins)
Append a where clause to the given statement checking if this value
is empty.
|
void |
appendIsNotEmpty(SQLBuffer sql,
Select sel,
Joins joins)
Append a where clause to the given statement checking if this value
is not empty.
|
void |
appendIsNotNull(SQLBuffer sql,
Select sel,
Joins joins)
Append a where clause to the given statement checking if this value
is not null.
|
void |
appendIsNull(SQLBuffer sql,
Select sel,
Joins joins)
Append a where clause to the given statement checking if this value
is null.
|
void |
appendSize(SQLBuffer sql,
Select sel,
Joins joins)
Append a where clause to the given statement checking the size
of the value.
|
void |
appendType(SQLBuffer sql,
Select sel,
Joins joins)
Append the entity discriminator value to the given statement.
|
void |
clearMapping()
Clear mapping information, including strategy.
|
void |
copy(FieldMetaData fmd)
Copy state from the given field to this one.
|
void |
copyMappingInfo(FieldMapping fm)
Copy mapping info from the given instance to this one.
|
void |
copyMappingInfo(ValueMapping vm)
Copy mapping info from the given instance to this one.
|
void |
customDelete(OpenJPAStateManager sm,
JDBCStore store)
Override this method to customize flushing this mapping.
|
void |
customInsert(OpenJPAStateManager sm,
JDBCStore store)
Override this method to customize flushing this mapping.
|
void |
customUpdate(OpenJPAStateManager sm,
JDBCStore store)
Override this method to customize flushing this mapping.
|
void |
delete(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set the where values appropriately to delete the proper instance,
and set all relations on non-secondary tables as updates.
|
void |
deleteRow(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Delete the row for this object if the reference foreign key exists.
|
String |
getAlias()
Return the alias of this strategy.
|
FieldMapping |
getBi_1ToM_JTField() |
FieldMapping |
getBi_MTo1_JTField() |
ForeignKey |
getBi1ToMElemFK() |
ForeignKey |
getBi1ToMJoinFK() |
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 from
ValueMetaData.getDeclaredTypeMetaData() . |
ClassMapping |
getDeclaringMapping()
Convenience method to perform cast from
FieldMetaData.getDeclaringMetaData() |
ClassMapping |
getDefiningMapping()
Convenience method to perform cast from
FieldMetaData.getDefiningMetaData() |
int |
getEagerFetchMode()
The eager fetch mode, as one of the eager constants in
JDBCFetchConfiguration . |
ValueMapping |
getElementMapping()
Convenience method to perform cast from
FieldMetaData.getElement() |
ClassMapping |
getEmbeddedMapping()
Convenience method to perform cast from
ValueMetaData.getEmbeddedMetaData() . |
FieldMapping |
getFieldMapping()
Convenience method to perform cast from
ValueMetaData.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.
|
FieldMapping[] |
getInverseMappings()
Convenience method to perform cast from
FieldMetaData.getInverseMetaDatas() |
ColumnIO |
getJoinColumnIO()
I/O information on the join columns.
|
int |
getJoinDirection()
The join direction.
|
ForeignKey |
getJoinForeignKey()
Foreign key linking the field table to the class' primary table.
|
Index |
getJoinIndex()
Index on join foreign key columns.
|
Unique[] |
getJoinTableUniques() |
Unique |
getJoinUnique()
Unique constraint on join foreign key columns.
|
ValueMapping |
getKeyMapping()
Convenience method to perform cast from
FieldMetaData.getKey() |
FieldMapping |
getMappedByMapping()
Convenience method to perform cast from
FieldMetaData.getMappedByMetaData() |
FieldMappingInfo |
getMappingInfo()
Raw mapping data about field's join to parent table, as well as
miscellaneous specialized columns like order column.
|
MappingRepository |
getMappingRepository()
Convenience method to perform cast from
FieldMetaData.getRepository() |
Column |
getOrderColumn()
Field order column, if any.
|
ColumnIO |
getOrderColumnIO()
I/O information for order column.
|
int |
getPolymorphic()
The degree to which this relation is polymorphic.
|
Row |
getRow(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm,
int action)
Return the row to use for this field.
|
int |
getSelectSubclasses()
Return the
org.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. |
FieldStrategy |
getStrategy()
The strategy used to map this mapping.
|
Table |
getTable()
The mapping's primary table.
|
ClassMapping |
getTypeMapping()
Convenience method to perform cast from
ValueMetaData.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 from
ValueMetaData.getValueMappedByMetaData() . |
ValueMapping |
getValueMapping()
Convenience method to perform cast from
FieldMetaData.getValue() |
Unique |
getValueUnique()
Unique constraint on this value's columns, or null if none.
|
boolean |
hasMapsIdCols() |
void |
initialize()
Perform caching and other initialization operations.
|
void |
insert(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set values for the mapping into the proper rows.
|
boolean |
isBi1To1JT() |
boolean |
isBidirectionalJoinTableMappingNonOwner()
Affirms if this field is the non-owning side of a bidirectional relation
with a join table.
|
boolean |
isBidirectionalJoinTableMappingOwner()
Affirms if this field is the owning side of a bidirectional relation
with a join table.
|
boolean |
isBiMTo1JT() |
Boolean |
isCustomDelete(OpenJPAStateManager sm,
JDBCStore store)
Return
Boolean.FALSE if this mapping does not customize the
delete process, Boolean.TRUE if it does, or null if it does
customize the delete, but also relies on the standard delete method
being called. |
Boolean |
isCustomInsert(OpenJPAStateManager sm,
JDBCStore store)
Return
Boolean.FALSE if this mapping does not customize the
insert process, Boolean.TRUE if it does, or null if it does
customize the insert, but also relies on the standard insert method
being called. |
Boolean |
isCustomUpdate(OpenJPAStateManager sm,
JDBCStore store)
Return
Boolean.FALSE if this mapping does not customize the
update process, Boolean.TRUE if it does, or null if it does
customize the update, but also relies on the standard update method
being called. |
boolean |
isDelayCapable() |
boolean |
isEagerSelectToMany()
Whether the eager joins or selects used by this field are to-many.
|
boolean |
isJoinOuter()
Whether to use an outer join from the class' primary table.
|
boolean |
isMapped()
Returns true if field class does not use the "none" strategy (including
if it has a null strategy, and therefore is probably in the process of
being mapped).
|
boolean |
isNonDefaultMappingUsingJoinTableStrategy() |
boolean |
isUni1To1JT() |
boolean |
isUni1ToMFK() |
boolean |
isUniMTo1JT() |
boolean |
isVersionable()
Return true if this field can be used as part of a state image for
optimistic locking.
|
Joins |
join(Joins joins,
boolean forceOuter)
Join this value to the class table.
|
Joins |
join(Joins joins,
boolean forceOuter,
boolean toMany)
Joins from the owning class' table to the table where this field lies
using the join foreign key.
|
Joins |
join(Select sel)
Return any joins needed to get from the primary table to this table.
|
Joins |
joinKey(Joins joins,
boolean forceOuter)
Join the key value to the class table.
|
Joins |
joinKeyRelation(Joins joins,
boolean forceOuter,
boolean traverse)
Join this value's table to the table for the related first class object
key type, if any.
|
Joins |
joinRelation(Joins joins,
boolean forceOuter,
boolean traverse)
Join this value's table to the table for the related first class object
type, if any.
|
void |
load(OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch)
Load secondary data using a connection from the store manager.
|
void |
load(OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
Result res)
Load virtual row data; the given result is not guaranteed to contain
data for this field, so the field mapping should make sure the
result contains its needed column data before loading.
|
void |
loadEagerJoin(OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
Result res)
Load the joined eager result.
|
Object |
loadEagerParallel(OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
Object res)
Load the batched eager result.
|
Object |
loadKeyProjection(JDBCStore store,
JDBCFetchConfiguration fetch,
Result res,
Joins joins)
Load this field's key value using the given result.
|
Object |
loadProjection(JDBCStore store,
JDBCFetchConfiguration fetch,
Result res,
Joins joins)
Load this field value using the given result.
|
void |
map(boolean adapt)
Map the owning mapping using this strategy.
|
void |
mapConstraints(DBIdentifier name,
boolean adapt)
Map indexes and constraints for this value, using the current
ValueMappingInfo . |
void |
mapConstraints(String name,
boolean adapt)
Deprecated.
|
void |
mapJoin(boolean adapt,
boolean joinRequired)
Map this field to its table, optionally requiring that it be
in another table.
|
void |
mapPrimaryKey(boolean adapt)
Maps the primary key on the secondary table for this field, if the
user's defaults create one.
|
void |
orderLocal(Select sel,
ClassMapping elem,
Joins joins)
Add ordering to the given select for all non-relation order values,
including the synthetic order column, if any.
|
void |
orderRelation(Select sel,
ClassMapping elem,
Joins joins)
Add ordering to the given select for all relation-based values.
|
void |
refSchemaComponents()
Increment the reference count of used schema components.
|
boolean |
resolve(int mode)
Resolve and validate metadata.
|
int |
select(Select sel,
OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eagerMode)
Select the virtual row columns of this mapping.
|
void |
selectEagerJoin(Select sel,
OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eagerMode)
Fill in joined select to related objects.
|
void |
selectEagerParallel(SelectExecutor sel,
OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eagerMode)
Fill in parallel eager select for related objects.
|
void |
setBi1MJoinTableInfo() |
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 |
setEagerFetchMode(int mode)
The eager fetch mode, as one of the eager constants in
JDBCFetchConfiguration . |
void |
setFieldMapping(FieldMapping owner)
Set the class mapping using this strategy.
|
void |
setForeignKey(ForeignKey fk)
If this value joins to another record, the foreign key.
|
void |
setForeignKey(Row row,
OpenJPAStateManager sm)
Sets this value's foreign key to the given related object.
|
void |
setForeignKey(Row row,
OpenJPAStateManager sm,
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 |
setJoinColumnIO(ColumnIO io)
I/O information on the join columns.
|
void |
setJoinDirection(int direction)
The join direction.
|
void |
setJoinForeignKey(ForeignKey fk)
Foreign key linking the field table to the class' primary table.
|
void |
setJoinIndex(Index idx)
Index on join foreign key columns.
|
void |
setJoinOuter(boolean outer)
Whether to use an outer join from the class' primary table.
|
void |
setJoinTableUniques(Unique[] unqs) |
void |
setJoinUnique(Unique unq)
Unique constraint on join foreign key columns.
|
void |
setMappedByIdValue(Object target,
Object val,
String mappedByIdFieldName) |
void |
setMapsIdCols(boolean hasMapsIdCols) |
void |
setOrderColumn(Column order)
Field order column, if any.
|
void |
setOrderColumnIO(ColumnIO io)
I/O information for order column.
|
void |
setPolymorphic(int poly)
The degree to which this relation is polymorphic.
|
void |
setStrategy(FieldStrategy strategy,
Boolean adapt)
The strategy used to map this mapping.
|
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.
|
int |
supportsSelect(Select sel,
int type,
OpenJPAStateManager sm,
JDBCStore store,
JDBCFetchConfiguration fetch)
Return whether this mapping can perform the given select type.
|
void |
syncMappingInfo()
Update
MappingInfo with our current mapping information. |
Object |
toDataStoreValue(Object val,
JDBCStore store)
Translate the given external field value to its datastore equivalent.
|
Object |
toKeyDataStoreValue(Object val,
JDBCStore store)
Translate the given key value to its datastore equivalent.
|
void |
update(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set values for the mapping into the proper rows.
|
protected boolean |
validateDataStoreExtensionPrefix(String prefix)
Return true if extensions starting with the given official datastore
prefix should be validated for this runtime.
|
void |
where(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm,
Object prevValue)
Add a WHERE condition to the row for this field such that the field's
current DB value must equal the given previous value.
|
void |
whereForeignKey(Row row,
OpenJPAStateManager sm)
Sets this value's foreign key to the given related object.
|
void |
wherePrimaryKey(Select sel,
OpenJPAStateManager sm,
JDBCStore store)
Add a
wherePrimaryKey or whereForeignKey
condition to the given select, depending on whether we have a join
foreign key. |
addEmbeddedMetaData, addEmbeddedMetaData, addExtensionKeys, backingMember, compareTo, copy, equals, getAccessType, getAssociationType, getBackingMember, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getComments, getCustomFetchGroups, getDeclaredIndex, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getDeclaringMetaData, getDeclaringType, getDefiningMetaData, getElement, getEmbeddedMetaData, getExternalizer, getExternalizerMethod, getExternalValue, getExternalValueMap, getExternalValues, getFactory, getFactoryMethod, getFieldMetaData, getFieldValue, getFieldValueMap, getFullName, getFullName, getIndex, getInitializer, getInverse, getInverseMetaDatas, getKey, getListingIndex, getLoadFetchGroup, getManagement, getMappedBy, getMappedByField, getMappedByIdValue, getMappedByMetaData, getName, getNullValue, getObjectIdFieldType, getObjectIdFieldTypeCode, getOrderDeclaration, getOrders, getPrimaryKeyIndex, getProxyType, getRealName, getRelationType, getRepository, getResolve, getSetterName, getType, getTypeCode, getTypeMetaData, getTypeOverride, getUpdateStrategy, getUseSchemaElement, getValue, getValueMappedBy, getValueMappedByMetaData, getValueSequenceMetaData, getValueSequenceName, getValueStrategy, hashCode, isDeclaredTypePC, isDefaultFetchGroupExplicit, isElementCollection, isEmbedded, isEmbeddedPC, isExplicit, isExternalized, isInDefaultFetchGroup, isInFetchGroup, isLRS, isMappedById, isPersistentCollection, isPrimaryKey, isSerialized, isStream, isTransient, isTypePC, isUsedInOrderBy, isValueGenerated, isVersion, order, setAccessType, setAssociationType, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setComments, setDeclaredIndex, setDeclaredType, setDeclaredTypeCode, setDeclaringType, setDefaultFetchGroupExplicit, setDelayCapable, setElementCollection, setEmbedded, setExplicit, setExternalizer, setExternalValues, setFactory, setInDefaultFetchGroup, setIndex, setInFetchGroup, setInitializer, setInverse, setListingIndex, setLoadFetchGroup, setLRS, setManagement, setMappedBy, setMappedByIdValue, setNullValue, setOrderDeclaration, setOrders, setPersistentCollection, setPrimaryKey, setPrimaryKeyIndex, setProxyType, setResolve, setResolve, setSerialized, setStream, setTransient, setType, setTypeCode, setTypeOverride, setUpdateStrategy, setUsedInOrderBy, setUseSchemaElement, setUsesImplData, setUsesIntermediate, setValueGenerated, setValueMappedBy, setValueSequenceName, setValueStrategy, setVersion, toString, usesImplData, usesIntermediate
addExtension, addExtension, copy, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension, validateExtensionKeys
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
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, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy
getRepository
public FieldMapping(String name, Class<?> type, ClassMapping owner)
public FieldMappingInfo getMappingInfo()
public FieldStrategy getStrategy()
public void setStrategy(FieldStrategy strategy, Boolean adapt)
adapt
parameter determines whether to adapt when mapping the strategy;
use null if the strategy should not be mapped.public Table getTable()
public ColumnIO getJoinColumnIO()
public void setJoinColumnIO(ColumnIO io)
public ForeignKey getJoinForeignKey()
public void setJoinForeignKey(ForeignKey fk)
public Unique getJoinUnique()
public void setJoinUnique(Unique unq)
public Unique[] getJoinTableUniques()
public void setJoinTableUniques(Unique[] unqs)
public Index getJoinIndex()
public void setJoinIndex(Index idx)
public boolean isJoinOuter()
public void setJoinOuter(boolean outer)
public Column getOrderColumn()
public void setOrderColumn(Column order)
public ColumnIO getOrderColumnIO()
public void setOrderColumnIO(ColumnIO io)
public void refSchemaComponents()
refSchemaComponents
in interface ValueMapping
public void clearMapping()
clearMapping
in interface ValueMapping
public void syncMappingInfo()
MappingInfo
with our current mapping information.syncMappingInfo
in interface ValueMapping
public boolean isMapped()
isMapped
in class FieldMetaData
public int getEagerFetchMode()
JDBCFetchConfiguration
.public void setEagerFetchMode(int mode)
JDBCFetchConfiguration
.public MappingRepository getMappingRepository()
FieldMetaData.getRepository()
getMappingRepository
in interface ValueMapping
public ClassMapping getDefiningMapping()
FieldMetaData.getDefiningMetaData()
public ClassMapping getDeclaringMapping()
FieldMetaData.getDeclaringMetaData()
public ValueMapping getKeyMapping()
FieldMetaData.getKey()
public ValueMapping getElementMapping()
FieldMetaData.getElement()
public ValueMapping getValueMapping()
FieldMetaData.getValue()
public FieldMapping getMappedByMapping()
FieldMetaData.getMappedByMetaData()
public FieldMapping[] getInverseMappings()
FieldMetaData.getInverseMetaDatas()
public boolean resolve(int mode)
FieldMetaData
resolve
in interface ValueMetaData
resolve
in class FieldMetaData
public void copyMappingInfo(FieldMapping fm)
public void copy(FieldMetaData fmd)
FieldMetaData
copy
in class FieldMetaData
protected boolean validateDataStoreExtensionPrefix(String prefix)
Extensions
validateDataStoreExtensionPrefix
in class Extensions
public String getAlias()
Strategy
public void map(boolean adapt)
Strategy
public void mapJoin(boolean adapt, boolean joinRequired)
public void mapPrimaryKey(boolean adapt)
public void initialize()
Strategy
Strategy.map(boolean)
, and after all related components have been
mapped as well.initialize
in interface Strategy
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
insert
in interface Strategy
SQLException
public void setMappedByIdValue(Object target, Object val, String mappedByIdFieldName)
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
update
in interface Strategy
SQLException
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
delete
in interface Strategy
SQLException
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
public void deleteRow(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
SQLException
public Row getRow(OpenJPAStateManager sm, JDBCStore store, RowManager rm, int action) throws SQLException
SQLException
public Boolean isCustomInsert(OpenJPAStateManager sm, JDBCStore store)
Strategy
Boolean.FALSE
if this mapping does not customize the
insert process, Boolean.TRUE
if it does, or null if it does
customize the insert, but also relies on the standard insert method
being called. Implement the Strategy.customInsert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method
to implement the custom insertion behavior.isCustomInsert
in interface Strategy
public Boolean isCustomUpdate(OpenJPAStateManager sm, JDBCStore store)
Strategy
Boolean.FALSE
if this mapping does not customize the
update process, Boolean.TRUE
if it does, or null if it does
customize the update, but also relies on the standard update method
being called. Implement the Strategy.customUpdate(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method
to override the default update behavior.isCustomUpdate
in interface Strategy
public Boolean isCustomDelete(OpenJPAStateManager sm, JDBCStore store)
Strategy
Boolean.FALSE
if this mapping does not customize the
delete process, Boolean.TRUE
if it does, or null if it does
customize the delete, but also relies on the standard delete method
being called. Implement the Strategy.customDelete(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore)
method
to override the default deletion behavior.isCustomDelete
in interface Strategy
public void customInsert(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customInsert
in interface Strategy
SQLException
public void customUpdate(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customUpdate
in interface Strategy
SQLException
public void customDelete(OpenJPAStateManager sm, JDBCStore store) throws SQLException
Strategy
customDelete
in interface Strategy
SQLException
public void setFieldMapping(FieldMapping owner)
FieldStrategy
setFieldMapping
in interface FieldStrategy
public int supportsSelect(Select sel, int type, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch)
FieldStrategy
supportsSelect
in interface FieldStrategy
Select
public void selectEagerParallel(SelectExecutor sel, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode)
FieldStrategy
public void selectEagerJoin(Select sel, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode)
FieldStrategy
public boolean isEagerSelectToMany()
FieldStrategy
isEagerSelectToMany
in interface FieldStrategy
public int select(Select sel, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode)
FieldStrategy
select
in interface FieldStrategy
sel
- the select to add tosm
- the instance being loaded, or null if not
initialized yet or selecting for multiple instancesstore
- the current store managerfetch
- fetch configurationeagerMode
- the eager fetch mode to use; this may be more
restrictive than the mode of the fetch configurationpublic Joins join(Select sel)
public void wherePrimaryKey(Select sel, OpenJPAStateManager sm, JDBCStore store)
wherePrimaryKey
or whereForeignKey
condition to the given select, depending on whether we have a join
foreign key.public void orderLocal(Select sel, ClassMapping elem, Joins joins)
elem
- the related type we're fetching, or nulljoins
- the joins to this field's tablepublic void orderRelation(Select sel, ClassMapping elem, Joins joins)
elem
- the related type we're fetchingjoins
- the joins across the relationpublic Object loadEagerParallel(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Object res) throws SQLException
FieldStrategy
loadEagerParallel
in interface FieldStrategy
res
- originally the Result
to load from, but this
method may return a processed result form that will be
passed to subsequent callsSQLException
public void loadEagerJoin(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res) throws SQLException
FieldStrategy
loadEagerJoin
in interface FieldStrategy
SQLException
public void load(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res) throws SQLException
FieldStrategy
load
in interface FieldStrategy
SQLException
public void load(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch) throws SQLException
FieldStrategy
load
in interface FieldStrategy
SQLException
public Object toDataStoreValue(Object val, JDBCStore store)
FieldStrategy
toDataStoreValue
in interface FieldStrategy
public Object toKeyDataStoreValue(Object val, JDBCStore store)
FieldStrategy
toKeyDataStoreValue
in interface FieldStrategy
public void appendIsEmpty(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendIsEmpty
in interface FieldStrategy
public void appendIsNotEmpty(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendIsNotEmpty
in interface FieldStrategy
public void appendIsNull(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendIsNull
in interface FieldStrategy
public void appendIsNotNull(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendIsNotNull
in interface FieldStrategy
public void appendSize(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendSize
in interface FieldStrategy
public void appendIndex(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendIndex
in interface FieldStrategy
public void appendType(SQLBuffer sql, Select sel, Joins joins)
FieldStrategy
appendType
in interface FieldStrategy
public Joins join(Joins joins, boolean forceOuter)
FieldStrategy
join
in interface FieldStrategy
public Joins joinKey(Joins joins, boolean forceOuter)
FieldStrategy
joinKey
in interface FieldStrategy
public Joins joinRelation(Joins joins, boolean forceOuter, boolean traverse)
FieldStrategy
joinRelation
in interface FieldStrategy
traverse
- if true, throw proper exception if it is not
possible for this mapping to traverse into the related typepublic Joins joinKeyRelation(Joins joins, boolean forceOuter, boolean traverse)
FieldStrategy
joinKeyRelation
in interface FieldStrategy
traverse
- if true, throw proper exception if it is not
possible for this mapping to traverse into the related typepublic Joins join(Joins joins, boolean forceOuter, boolean toMany)
public Object loadProjection(JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException
FieldStrategy
ValueMapping.getColumns()
.loadProjection
in interface FieldStrategy
SQLException
public Object loadKeyProjection(JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException
FieldStrategy
ValueMapping.getColumns()
.loadKeyProjection
in interface FieldStrategy
SQLException
public boolean isVersionable()
FieldStrategy
isVersionable
in interface FieldStrategy
public void where(OpenJPAStateManager sm, JDBCStore store, RowManager rm, Object prevValue) throws SQLException
FieldStrategy
where
in interface FieldStrategy
SQLException
public ValueMappingInfo getValueInfo()
ValueMapping
getValueInfo
in interface ValueMapping
public ValueHandler getHandler()
ValueMapping
getHandler
in interface ValueMapping
public void setHandler(ValueHandler handler)
ValueMapping
setHandler
in interface ValueMapping
public FieldMapping getFieldMapping()
ValueMapping
ValueMetaData.getFieldMetaData()
.getFieldMapping
in interface ValueMapping
public ClassMapping getTypeMapping()
ValueMapping
ValueMetaData.getTypeMetaData()
.getTypeMapping
in interface ValueMapping
public ClassMapping getDeclaredTypeMapping()
ValueMapping
ValueMetaData.getDeclaredTypeMetaData()
.getDeclaredTypeMapping
in interface ValueMapping
public ClassMapping getEmbeddedMapping()
ValueMapping
ValueMetaData.getEmbeddedMetaData()
.getEmbeddedMapping
in interface ValueMapping
public FieldMapping getValueMappedByMapping()
ValueMapping
ValueMetaData.getValueMappedByMetaData()
.getValueMappedByMapping
in interface ValueMapping
public Column[] getColumns()
ValueMapping
getColumns
in interface ValueMapping
public void setColumns(Column[] cols)
ValueMapping
setColumns
in interface ValueMapping
public ColumnIO getColumnIO()
ValueMapping
getColumnIO
in interface ValueMapping
public void setColumnIO(ColumnIO io)
ValueMapping
setColumnIO
in interface ValueMapping
public ForeignKey getForeignKey()
ValueMapping
getForeignKey
in interface ValueMapping
public ForeignKey getForeignKey(ClassMapping target)
ValueMapping
getForeignKey
in interface ValueMapping
public void setForeignKey(ForeignKey fk)
ValueMapping
setForeignKey
in interface ValueMapping
public int getJoinDirection()
ValueMapping
getJoinDirection
in interface ValueMapping
public void setJoinDirection(int direction)
ValueMapping
setJoinDirection
in interface ValueMapping
public void setForeignKey(Row row, OpenJPAStateManager sm) throws SQLException
ValueMapping
setForeignKey
in interface ValueMapping
SQLException
public void setForeignKey(Row row, OpenJPAStateManager sm, int targetNumber) throws SQLException
ValueMapping
setForeignKey
in interface ValueMapping
SQLException
public void whereForeignKey(Row row, OpenJPAStateManager sm) throws SQLException
ValueMapping
whereForeignKey
in interface ValueMapping
SQLException
public ClassMapping[] getIndependentTypeMappings()
ValueMapping
getIndependentTypeMappings
in interface ValueMapping
public int getSelectSubclasses()
ValueMapping
org.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.getSelectSubclasses
in interface ValueMapping
public Unique getValueUnique()
ValueMapping
getValueUnique
in interface ValueMapping
public void setValueUnique(Unique unq)
ValueMapping
setValueUnique
in interface ValueMapping
public Index getValueIndex()
ValueMapping
getValueIndex
in interface ValueMapping
public void setValueIndex(Index idx)
ValueMapping
setValueIndex
in interface ValueMapping
public boolean getUseClassCriteria()
ValueMapping
getUseClassCriteria
in interface ValueMapping
public void setUseClassCriteria(boolean criteria)
ValueMapping
setUseClassCriteria
in interface ValueMapping
public int getPolymorphic()
ValueMapping
getPolymorphic
in interface ValueMapping
public void setPolymorphic(int poly)
ValueMapping
setPolymorphic
in interface ValueMapping
@Deprecated public void mapConstraints(String name, boolean adapt)
ValueMapping
ValueMappingInfo
. The foreign key or columns of this value
must be set before calling this method.mapConstraints
in interface ValueMapping
public void mapConstraints(DBIdentifier name, boolean adapt)
ValueMapping
ValueMappingInfo
. The foreign key or columns of this value
must be set before calling this method.mapConstraints
in interface ValueMapping
public void copyMappingInfo(ValueMapping vm)
ValueMapping
copyMappingInfo
in interface ValueMapping
public boolean isBidirectionalJoinTableMappingOwner()
public boolean isBidirectionalJoinTableMappingNonOwner()
public boolean isBiMTo1JT()
public boolean isUni1ToMFK()
public boolean isUniMTo1JT()
public boolean isUni1To1JT()
public boolean isBi1To1JT()
public FieldMapping getBi_1ToM_JTField()
public FieldMapping getBi_MTo1_JTField()
public ForeignKey getBi1ToMJoinFK()
public ForeignKey getBi1ToMElemFK()
public void setBi1MJoinTableInfo()
public boolean isNonDefaultMappingUsingJoinTableStrategy()
public void setMapsIdCols(boolean hasMapsIdCols)
public boolean hasMapsIdCols()
public boolean isDelayCapable()
isDelayCapable
in class FieldMetaData
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.