EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.descriptors
Class TablePerClassPolicy

java.lang.Object
  extended by org.eclipse.persistence.descriptors.InterfacePolicy
      extended by org.eclipse.persistence.descriptors.TablePerClassPolicy
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class TablePerClassPolicy
extends InterfacePolicy
implements java.io.Serializable, java.lang.Cloneable

Purpose: Provides the functionality to support a TABLE_PER_CLASS inheritance strategy. Resolves relational mappings and querying.

See Also:
Serialized Form

Field Summary
protected  java.util.HashMap<DatabaseMapping,DatabaseQuery> selectionQueriesForAllObjects
          Selection queries from read all mappings will be cached and re-used.
 
Fields inherited from class org.eclipse.persistence.descriptors.InterfacePolicy
childDescriptors, descriptor, implementorDescriptor, implementorDescriptorClassName, parentDescriptors, parentInterfaceNames, parentInterfaces
 
Constructor Summary
TablePerClassPolicy(ClassDescriptor descriptor)
          INTERNAL: Create a new policy.
 
Method Summary
protected  void addSelectionQuery(ForeignReferenceMapping cloneMapping, ForeignReferenceMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL:
 boolean isTablePerClassPolicy()
          INTERNAL:
 void prepareChildrenSelectionQuery(DatabaseMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This method is called from individual mappings during their initialization.
protected  void prepareManyToManySelectionQuery(ManyToManyMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL:
protected  void prepareOneToManySelectionQuery(OneToManyMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL:
protected  void prepareOneToOneSelectionQuery(OneToOneMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL:
protected  void prepareSelectionQuery(DatabaseMapping sourceMapping, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: The selection queries are created by cloning the source mapping, updating the necessary database fields on the mapping and then initializing the mapping to create the internal selection query.
protected  java.lang.Object selectAllObjects(ReadAllQuery query)
          INTERNAL: Select all objects for a concrete descriptor.
protected  java.lang.Object selectOneObject(ReadObjectQuery query)
          INTERNAL: Select one object of any concrete subclass.
 
Methods inherited from class org.eclipse.persistence.descriptors.InterfacePolicy
addChildDescriptor, addParentDescriptor, addParentInterface, addParentInterfaceName, convertClassNamesToClasses, getChildDescriptors, getDescriptor, getImplementorDescriptor, getImplementorDescriptorClassName, getParentDescriptors, getParentInterfaceNames, getParentInterfaces, hasChild, initialize, isInterfaceChildDescriptor, selectAllObjectsUsingMultipleTableSubclassRead, selectOneObjectUsingMultipleTableSubclassRead, setDescriptor, setImplementorDescriptor, setImplementorDescriptorClassName, setParentInterfaceNames, setParentInterfaces, usesImplementorDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectionQueriesForAllObjects

protected java.util.HashMap<DatabaseMapping,DatabaseQuery> selectionQueriesForAllObjects
Selection queries from read all mappings will be cached and re-used. E.G Entity A has a 1-M to Entity D (who has a subclass Entity E). We will build a selection query to Entity E based on the selection query from the 1-M mapping from Entity A to Entity D.

Constructor Detail

TablePerClassPolicy

public TablePerClassPolicy(ClassDescriptor descriptor)
INTERNAL: Create a new policy. Only descriptors involved in inheritance should have a policy.

Method Detail

addSelectionQuery

protected void addSelectionQuery(ForeignReferenceMapping cloneMapping,
                                 ForeignReferenceMapping sourceMapping,
                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:


isTablePerClassPolicy

public boolean isTablePerClassPolicy()
INTERNAL:

Overrides:
isTablePerClassPolicy in class InterfacePolicy

prepareChildrenSelectionQuery

public void prepareChildrenSelectionQuery(DatabaseMapping sourceMapping,
                                          org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This method is called from individual mappings during their initialization. If the mapping is to a class within a TABLE_PER_CLASS inheritance hierarchy, what this method will do is prepare a selection query to execute for every child descriptor in the hierarchy. The selection queries are created by cloning the source mapping, updating the necessary database fields on the mapping and then initializing the mapping to create the internal selection query. This query is then cached where needed using the source mapping's selection query name as the key.

See Also:
selectAllObjects(ReadAllQuery), selectOneObject(ReadObjectQuery)

prepareManyToManySelectionQuery

protected void prepareManyToManySelectionQuery(ManyToManyMapping sourceMapping,
                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:


prepareOneToManySelectionQuery

protected void prepareOneToManySelectionQuery(OneToManyMapping sourceMapping,
                                              org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:


prepareOneToOneSelectionQuery

protected void prepareOneToOneSelectionQuery(OneToOneMapping sourceMapping,
                                             org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:


prepareSelectionQuery

protected void prepareSelectionQuery(DatabaseMapping sourceMapping,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: The selection queries are created by cloning the source mapping, updating the necessary database fields on the mapping and then initializing the mapping to create the internal selection query. This query is then cached where needed using the source mapping as the key. A prepare is performed for each child of the hierarchy.


selectAllObjects

protected java.lang.Object selectAllObjects(ReadAllQuery query)
INTERNAL: Select all objects for a concrete descriptor.

Overrides:
selectAllObjects in class InterfacePolicy

selectOneObject

protected java.lang.Object selectOneObject(ReadObjectQuery query)
                                    throws DescriptorException
INTERNAL: Select one object of any concrete subclass.

Overrides:
selectOneObject in class InterfacePolicy
Throws:
DescriptorException

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference