Class HandlerHandlerMapTableFieldStrategy
java.lang.Object
org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
org.apache.openjpa.jdbc.meta.strats.ContainerFieldStrategy
org.apache.openjpa.jdbc.meta.strats.MapTableFieldStrategy
org.apache.openjpa.jdbc.meta.strats.HandlerHandlerMapTableFieldStrategy
- All Implemented Interfaces:
Serializable,FieldStrategy,Strategy,LRSMapFieldStrategy
Mapping for a map of keys and values both controlled by
ValueHandlers.- Since:
- 0.4.0, 1.1.0
- Author:
- Abe White
- See Also:
-
Field Summary
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionColumn[]Return the columns holding data for a map key for the given key mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)orLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null).Result[]getResults(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode, Joins[] joins, boolean lrs) Return results containing all keys and values for this map.Column[]Return the columns holding data for a map value for the given value mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)orLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null).voidPerform caching and other initialization operations.voidinsert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) Set values for the mapping into the proper rows.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.joinRelation(Joins joins, boolean forceOuter, boolean traverse) Join this value's table to the table for the related first class object type, if any.loadKey(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) Load a key from the given result.loadValue(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) Load a value from the given result.voidmap(boolean adapt) Map the owning mapping using this strategy.voidselectKey(Select sel, ClassMapping cls, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Implement this method to select the keys of this field.voidselectValue(Select sel, ClassMapping cls, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Implement this method to select the values of this field.toDataStoreValue(Object val, JDBCStore store) Translate the given external field value to its datastore equivalent.toKeyDataStoreValue(Object val, JDBCStore store) Translate the given key value to its datastore equivalent.voidupdate(OpenJPAStateManager sm, JDBCStore store, RowManager rm) Set values for the mapping into the proper rows.Methods inherited from class org.apache.openjpa.jdbc.meta.strats.MapTableFieldStrategy
delete, deriveKey, deriveValue, getFieldMapping, getIndependentElementMappings, getIndependentKeyMappings, getIndependentValueMappings, getJoinForeignKey, getJoinForeignKey, handleMappedByForeignKey, isTypeUnjoinedSubclass, join, joinKey, joinKeyRelation, joinValueRelation, load, loadKeyProjection, loadProjection, populateKey, supportsSelectMethods inherited from class org.apache.openjpa.jdbc.meta.strats.ContainerFieldStrategy
appendIndex, appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendJoinCount, appendSize, appendUnaliasedJoinMethods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
appendType, assertNotMappedBy, isEagerSelectToMany, isVersionable, load, loadEagerJoin, loadEagerParallel, select, selectEagerJoin, selectEagerParallel, setFieldMapping, whereMethods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, getAlias, isCustomDelete, isCustomInsert, isCustomUpdateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.openjpa.jdbc.meta.FieldStrategy
appendIndex, appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendSize, appendType, isEagerSelectToMany, isVersionable, load, loadEagerJoin, loadEagerParallel, select, selectEagerJoin, selectEagerParallel, setFieldMapping, whereMethods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, getAlias, isCustomDelete, isCustomInsert, isCustomUpdate
-
Constructor Details
-
HandlerHandlerMapTableFieldStrategy
public HandlerHandlerMapTableFieldStrategy()
-
-
Method Details
-
getKeyColumns
Description copied from interface:LRSMapFieldStrategyReturn the columns holding data for a map key for the given key mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)orLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null). -
getValueColumns
Description copied from interface:LRSMapFieldStrategyReturn the columns holding data for a map value for the given value mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)orLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null). -
selectKey
public void selectKey(Select sel, ClassMapping cls, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Description copied from interface:LRSMapFieldStrategyImplement this method to select the keys of this field. Elements of the result will be loaded withLRSMapFieldStrategy.loadKey(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, org.apache.openjpa.jdbc.sql.Result, org.apache.openjpa.jdbc.sql.Joins). This method is only used if the key is not derived from the value. -
selectValue
public void selectValue(Select sel, ClassMapping cls, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Description copied from interface:LRSMapFieldStrategyImplement this method to select the values of this field. Elements of the result will be loaded withLRSMapFieldStrategy.loadValue(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, org.apache.openjpa.jdbc.sql.Result, org.apache.openjpa.jdbc.sql.Joins). -
getResults
public Result[] getResults(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode, Joins[] joins, boolean lrs) throws SQLException Description copied from interface:LRSMapFieldStrategyReturn results containing all keys and values for this map. If only one result is needed, set both array indexes to the same result instance. Also fill in the key and value joins in the given array. The results will be loaded with theLRSMapFieldStrategy.loadKey(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, org.apache.openjpa.jdbc.sql.Result, org.apache.openjpa.jdbc.sql.Joins)orLRSMapFieldStrategy.deriveKey(org.apache.openjpa.jdbc.kernel.JDBCStore, java.lang.Object)andLRSMapFieldStrategy.loadValue(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, org.apache.openjpa.jdbc.sql.Result, org.apache.openjpa.jdbc.sql.Joins)methods.- Throws:
SQLException
-
loadKey
public Object loadKey(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException Description copied from interface:LRSMapFieldStrategyLoad a key from the given result. This method is only used if the key is not derived from the value.- Throws:
SQLException
-
loadValue
public Object loadValue(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException Description copied from interface:LRSMapFieldStrategyLoad a value from the given result.- Throws:
SQLException
-
map
public void map(boolean adapt) Description copied from interface:StrategyMap the owning mapping using this strategy.- Specified by:
mapin interfaceStrategy- Overrides:
mapin classMapTableFieldStrategy- Parameters:
adapt- if true, use the owning mapping's raw mapping info to set its ORM data; if false, ORM data will already be set
-
initialize
public void initialize()Description copied from interface:StrategyPerform caching and other initialization operations. This method is called afterStrategy.map(boolean), and after all related components have been mapped as well.- Specified by:
initializein interfaceStrategy- Overrides:
initializein classAbstractStrategy
-
insert
Description copied from interface:StrategySet values for the mapping into the proper rows. For class mappings, this method will be called only after the corresponding method has been called for all fields of this mapping.- Specified by:
insertin interfaceStrategy- Overrides:
insertin classAbstractStrategy- Throws:
SQLException
-
update
Description copied from interface:StrategySet values for the mapping into the proper rows.- Specified by:
updatein interfaceStrategy- Overrides:
updatein classAbstractStrategy- Throws:
SQLException- See Also:
-
toDataStoreValue
Description copied from interface:FieldStrategyTranslate the given external field value to its datastore equivalent. If the mapping occupies multiple columns in the datastore, return an object array, else return a single object. Simply returns the given object by default.- Specified by:
toDataStoreValuein interfaceFieldStrategy- Overrides:
toDataStoreValuein classAbstractFieldStrategy
-
toKeyDataStoreValue
Description copied from interface:FieldStrategyTranslate the given key value to its datastore equivalent. If the mapping occupies multiple columns in the datastore, return an object array, else return a single object. Simply returns the given object by default.- Specified by:
toKeyDataStoreValuein interfaceFieldStrategy- Overrides:
toKeyDataStoreValuein classAbstractFieldStrategy
-
joinRelation
Description copied from interface:FieldStrategyJoin this value's table to the table for the related first class object type, if any. Does nothing by default.- Specified by:
joinRelationin interfaceFieldStrategy- Overrides:
joinRelationin classAbstractFieldStrategytraverse- if true, throw proper exception if it is not possible for this mapping to traverse into the related type
-
joinKeyRelation
Description copied from interface:FieldStrategyJoin this value's table to the table for the related first class object key type, if any. Does nothing by default.- Specified by:
joinKeyRelationin interfaceFieldStrategy- Overrides:
joinKeyRelationin classAbstractFieldStrategytraverse- if true, throw proper exception if it is not possible for this mapping to traverse into the related type
-