org.apache.openjpa.jdbc.meta.strats
Class RelationCollectionInverseKeyFieldStrategy

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
      extended by org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
          extended by org.apache.openjpa.jdbc.meta.strats.ContainerFieldStrategy
              extended by org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy
                  extended by org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy
                      extended by org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy
All Implemented Interfaces:
Serializable, FieldStrategy, Strategy, LRSCollectionFieldStrategy

public class RelationCollectionInverseKeyFieldStrategy
extends RelationToManyInverseKeyFieldStrategy
implements LRSCollectionFieldStrategy

Maps a relation to a collection of other objects using an inverse foreign key in the related object table.

Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
field
 
Constructor Summary
RelationCollectionInverseKeyFieldStrategy()
           
 
Method Summary
 Column[] getElementColumns(ClassMapping elem)
          Return the columns holding the data for a collection element for the given element mapping from LRSCollectionFieldStrategy.getIndependentElementMappings(boolean) (or null).
 FieldMapping getFieldMapping()
          The owning field mapping.
 ClassMapping[] getIndependentElementMappings(boolean traverse)
          Return all independent mappings to which this strategy must join in order to access collection elements, or empty array if none.
 ForeignKey getJoinForeignKey(ClassMapping elem)
          Return the foreign key used to join to the owning field for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).
 Joins join(Joins joins, ClassMapping elem)
          Join to the owning field table for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).
 Joins joinElementRelation(Joins joins, ClassMapping elem)
          Join this value's table to the table for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).
 Object loadElement(OpenJPAStateManager sm, JDBCStore store, JDBCFetchConfiguration fetch, Result res, Joins joins)
          Load an element of the collection.
 void map(boolean adapt)
          Map the owning mapping using this strategy.
protected  Proxy newLRSProxy()
          Return a large result set proxy for this field.
 void selectElement(Select sel, ClassMapping elem, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode, Joins joins)
          Implement this method to select the elements of this field for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy
delete, initialize, insert, join, toDataStoreValue, update
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy
add, getJoinForeignKey, isEagerSelectToMany, load, loadEagerJoin, loadEagerParallel, loadProjection, requiresOrderBy, selectAll, selectEagerJoin, selectEagerParallel, supportsSelect, toCollection
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.ContainerFieldStrategy
appendIndex, appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendJoinCount, appendSize, appendUnaliasedJoin
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractFieldStrategy
appendType, assertNotMappedBy, isVersionable, joinKey, joinKeyRelation, joinRelation, load, loadKeyProjection, select, setFieldMapping, toKeyDataStoreValue, where
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, getAlias, isCustomDelete, isCustomInsert, isCustomUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.FieldStrategy
appendIndex, appendIsEmpty, appendIsNotEmpty, appendIsNotNull, appendIsNull, appendSize, appendType, isEagerSelectToMany, isVersionable, join, joinKey, joinKeyRelation, joinRelation, load, load, loadEagerJoin, loadEagerParallel, loadKeyProjection, loadProjection, select, selectEagerJoin, selectEagerParallel, setFieldMapping, supportsSelect, toDataStoreValue, toKeyDataStoreValue, where
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, update
 

Constructor Detail

RelationCollectionInverseKeyFieldStrategy

public RelationCollectionInverseKeyFieldStrategy()
Method Detail

getFieldMapping

public FieldMapping getFieldMapping()
Description copied from interface: LRSCollectionFieldStrategy
The owning field mapping.

Specified by:
getFieldMapping in interface LRSCollectionFieldStrategy

getIndependentElementMappings

public ClassMapping[] getIndependentElementMappings(boolean traverse)
Description copied from class: ContainerFieldStrategy
Return all independent mappings to which this strategy must join in order to access collection elements, or empty array if none.

Specified by:
getIndependentElementMappings in interface LRSCollectionFieldStrategy
Overrides:
getIndependentElementMappings in class RelationToManyInverseKeyFieldStrategy
Parameters:
traverse - whether we're traversing through to the related type
See Also:
ValueMapping.getIndependentTypeMappings(), ClassMapping.EMPTY_MAPPINGS

getElementColumns

public Column[] getElementColumns(ClassMapping elem)
Description copied from interface: LRSCollectionFieldStrategy
Return the columns holding the data for a collection element for the given element mapping from LRSCollectionFieldStrategy.getIndependentElementMappings(boolean) (or null).

Specified by:
getElementColumns in interface LRSCollectionFieldStrategy

getJoinForeignKey

public ForeignKey getJoinForeignKey(ClassMapping elem)
Description copied from class: StoreCollectionFieldStrategy
Return the foreign key used to join to the owning field for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).

Specified by:
getJoinForeignKey in interface LRSCollectionFieldStrategy
Overrides:
getJoinForeignKey in class RelationToManyInverseKeyFieldStrategy

selectElement

public void selectElement(Select sel,
                          ClassMapping elem,
                          JDBCStore store,
                          JDBCFetchConfiguration fetch,
                          int eagerMode,
                          Joins joins)
Description copied from class: StoreCollectionFieldStrategy
Implement this method to select the elements of this field for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null). Elements of the result will be loaded with StoreCollectionFieldStrategy.loadElement(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:
selectElement in interface LRSCollectionFieldStrategy
Overrides:
selectElement in class RelationToManyInverseKeyFieldStrategy

loadElement

public Object loadElement(OpenJPAStateManager sm,
                          JDBCStore store,
                          JDBCFetchConfiguration fetch,
                          Result res,
                          Joins joins)
                   throws SQLException
Description copied from class: StoreCollectionFieldStrategy
Load an element of the collection. The given state manager might be null if the load is for a projection or for processing eager parallel results.

Specified by:
loadElement in interface LRSCollectionFieldStrategy
Overrides:
loadElement in class RelationToManyInverseKeyFieldStrategy
Throws:
SQLException

join

public Joins join(Joins joins,
                  ClassMapping elem)
Description copied from class: StoreCollectionFieldStrategy
Join to the owning field table for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).

Overrides:
join in class RelationToManyInverseKeyFieldStrategy

joinElementRelation

public Joins joinElementRelation(Joins joins,
                                 ClassMapping elem)
Description copied from class: StoreCollectionFieldStrategy
Join this value's table to the table for the given element mapping from ContainerFieldStrategy.getIndependentElementMappings(boolean) (or null).

Specified by:
joinElementRelation in interface LRSCollectionFieldStrategy
Overrides:
joinElementRelation in class RelationToManyInverseKeyFieldStrategy
See Also:
FieldMapping.joinRelation(org.apache.openjpa.jdbc.sql.Joins, boolean, boolean)

newLRSProxy

protected Proxy newLRSProxy()
Description copied from class: StoreCollectionFieldStrategy
Return a large result set proxy for this field.

Specified by:
newLRSProxy in class StoreCollectionFieldStrategy

map

public void map(boolean adapt)
Description copied from interface: Strategy
Map the owning mapping using this strategy.

Specified by:
map in interface Strategy
Overrides:
map in class RelationToManyInverseKeyFieldStrategy
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


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.