Class RelationMapInverseKeyFieldStrategy
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.StoreCollectionFieldStrategy
org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy
org.apache.openjpa.jdbc.meta.strats.RelationMapInverseKeyFieldStrategy
- All Implemented Interfaces:
Serializable,FieldStrategy,Strategy,LRSMapFieldStrategy
public class RelationMapInverseKeyFieldStrategy
extends RelationToManyInverseKeyFieldStrategy
implements LRSMapFieldStrategy
Uses an inverse foreign key in the table of the map value to determine
map values. Derives map keys from a field in each value.
- 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 TypeMethodDescriptionprotected voidAdd an item to the data structure representing a field value.Some mapping derive keys from map values.deriveValue(JDBCStore store, Object key) Some mapping derive values from map keys.The owning field mapping.getIndependentKeyMappings(boolean traverse) Return all independent mappings to which this strategy must join in order to access map keys, or empty array if none.getIndependentValueMappings(boolean traverse) Return all independent mappings to which this strategy must join in order to access map values, or empty array if none.Return the foreign key used to join to the owning field for the given element mapping fromContainerFieldStrategy.getIndependentElementMappings(boolean)(or null).Column[]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).Join the key value to the class table.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.joinKeyRelation(Joins joins, ClassMapping key) Join this value's table to the table for the given key mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)(or null).joinValueRelation(Joins joins, ClassMapping val) Join this value's table to the table for the given value mapping fromLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null).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.protected ProxyReturn a large result set proxy for this field.voidselectKey(Select sel, ClassMapping key, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Implement this method to select the keys of this field.voidselectValue(Select sel, ClassMapping val, OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Implement this method to select the values of this field.protected CollectiontoCollection(Object val) Convert the field value to a collection.Methods inherited from class org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy
delete, getIndependentElementMappings, initialize, insert, join, join, joinElementRelation, loadElement, selectElement, toDataStoreValue, updateMethods inherited from class org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy
getJoinForeignKey, isEagerSelectToMany, load, loadEagerJoin, loadEagerParallel, loadProjection, selectAll, selectEagerJoin, selectEagerParallel, 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, isVersionable, joinRelation, load, loadKeyProjection, select, setFieldMapping, toKeyDataStoreValue, 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, join, joinRelation, load, load, loadEagerJoin, loadEagerParallel, loadKeyProjection, loadProjection, select, selectEagerJoin, selectEagerParallel, setFieldMapping, supportsSelect, toDataStoreValue, toKeyDataStoreValue, whereMethods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, update
-
Constructor Details
-
RelationMapInverseKeyFieldStrategy
public RelationMapInverseKeyFieldStrategy()
-
-
Method Details
-
getFieldMapping
Description copied from interface:LRSMapFieldStrategyThe owning field mapping.- Specified by:
getFieldMappingin interfaceLRSMapFieldStrategy
-
getIndependentKeyMappings
Description copied from interface:LRSMapFieldStrategyReturn all independent mappings to which this strategy must join in order to access map keys, or empty array if none.- Specified by:
getIndependentKeyMappingsin interfaceLRSMapFieldStrategy- See Also:
-
getIndependentValueMappings
Description copied from interface:LRSMapFieldStrategyReturn all independent mappings to which this strategy must join in order to access map values, or empty array if none.- Specified by:
getIndependentValueMappingsin interfaceLRSMapFieldStrategy- See Also:
-
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).- Specified by:
getKeyColumnsin interfaceLRSMapFieldStrategy
-
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).- Specified by:
getValueColumnsin interfaceLRSMapFieldStrategy
-
getJoinForeignKey
Description copied from class:StoreCollectionFieldStrategyReturn the foreign key used to join to the owning field for the given element mapping fromContainerFieldStrategy.getIndependentElementMappings(boolean)(or null).- Specified by:
getJoinForeignKeyin interfaceLRSMapFieldStrategy- Overrides:
getJoinForeignKeyin classRelationToManyInverseKeyFieldStrategy
-
selectKey
public void selectKey(Select sel, ClassMapping key, 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.- Specified by:
selectKeyin interfaceLRSMapFieldStrategy
-
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.- Specified by:
loadKeyin interfaceLRSMapFieldStrategy- Throws:
SQLException
-
deriveKey
Description copied from interface:LRSMapFieldStrategySome mapping derive keys from map values. Other mappings may return null.- Specified by:
deriveKeyin interfaceLRSMapFieldStrategy
-
deriveValue
Description copied from interface:LRSMapFieldStrategySome mapping derive values from map keys. Other mappings may return null.- Specified by:
deriveValuein interfaceLRSMapFieldStrategy
-
selectValue
public void selectValue(Select sel, ClassMapping val, 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).- Specified by:
selectValuein interfaceLRSMapFieldStrategy
-
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.- Specified by:
loadValuein interfaceLRSMapFieldStrategy- Throws:
SQLException
-
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.- Specified by:
getResultsin interfaceLRSMapFieldStrategy- Throws:
SQLException
-
joinKeyRelation
Description copied from interface:LRSMapFieldStrategyJoin this value's table to the table for the given key mapping fromLRSMapFieldStrategy.getIndependentKeyMappings(boolean)(or null).- Specified by:
joinKeyRelationin interfaceLRSMapFieldStrategy
-
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
-
joinValueRelation
Description copied from interface:LRSMapFieldStrategyJoin this value's table to the table for the given value mapping fromLRSMapFieldStrategy.getIndependentValueMappings(boolean)(or null).- Specified by:
joinValueRelationin interfaceLRSMapFieldStrategy
-
newLRSProxy
Description copied from class:StoreCollectionFieldStrategyReturn a large result set proxy for this field.- Specified by:
newLRSProxyin classStoreCollectionFieldStrategy
-
add
Description copied from class:StoreCollectionFieldStrategyAdd an item to the data structure representing a field value. By default, assumes the structure is a collection.- Overrides:
addin classStoreCollectionFieldStrategy
-
toCollection
Description copied from class:StoreCollectionFieldStrategyConvert the field value to a collection. Handles collections and arrays by default.- Overrides:
toCollectionin classStoreCollectionFieldStrategy
-
map
public void map(boolean adapt) Description copied from interface:StrategyMap the owning mapping using this strategy.- Specified by:
mapin interfaceStrategy- Overrides:
mapin classRelationToManyInverseKeyFieldStrategy- 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
-
joinKey
Description copied from interface:FieldStrategyJoin the key value to the class table. Does nothing by default.- Specified by:
joinKeyin interfaceFieldStrategy- Overrides:
joinKeyin classAbstractFieldStrategy
-