Class InheritancePolicy
java.lang.Object
org.eclipse.persistence.core.descriptors.CoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,org.eclipse.persistence.internal.sessions.AbstractSession,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
org.eclipse.persistence.descriptors.InheritancePolicy
- All Implemented Interfaces:
Serializable
,Cloneable
public class InheritancePolicy
extends CoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,org.eclipse.persistence.internal.sessions.AbstractSession,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
implements Serializable, Cloneable
Purpose: Allows customization of an object's inheritance. The primary supported inheritance model uses a class type indicator column in the table that stores the object's class type. The class-to-type mapping is specified on this policy. The full class name can also be used for the indicator instead of the mapping.
Each subclass can either share their parents table, or in addition add their own table(s).
For legacy models a customized inheritance class-extractor can be provided. This allows Java code to be used to compute the class type to use for a row. When this customized inheritance model is used an only-instances and with-all-subclasses filter expression may be required for concrete and branch querying.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Vector
protected List<ClassDescriptor>
protected Expression
protected List<org.eclipse.persistence.internal.helper.DatabaseTable>
protected Map<org.eclipse.persistence.internal.helper.DatabaseTable,
Expression> protected ClassExtractor
protected String
Allow for class extraction method to be specified.protected org.eclipse.persistence.internal.helper.DatabaseField
protected Map
protected Map
protected boolean
protected ClassDescriptor
protected boolean
protected Expression
protected Class
protected String
protected ClassDescriptor
protected org.eclipse.persistence.internal.helper.DatabaseTable
protected ClassDescriptor
PERF: Cache root descriptor.protected boolean
protected boolean
Define if an outer join should be used to read subclasses.protected Boolean
protected boolean
protected boolean
protected Expression
-
Constructor Summary
ConstructorDescriptionINTERNAL: Create a new policy.InheritancePolicy
(ClassDescriptor descriptor) INTERNAL: Create a new policy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildDescriptor
(ClassDescriptor childDescriptor) INTERNAL: Add child descriptor to the parent descriptor.protected void
addChildTableJoinExpression
(org.eclipse.persistence.internal.helper.DatabaseTable table, Expression expression) INTERNAL: childrenTablesJoinExpressions, childrenTables, allTables and childrenJoinExpression are created simultaneously and kept in sync.void
addChildTableJoinExpressionToAllParents
(org.eclipse.persistence.internal.helper.DatabaseTable table, Expression expression) INTERNAL: call addChildTableJoinExpression on all parentsvoid
addClassIndicator
(Class childClass, Object typeValue) PUBLIC: Add a class indicator for the root classes subclass.void
addClassIndicatorFieldToInsertRow
(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow) INTERNAL: Add abstract class indicator information to the database row.void
addClassIndicatorFieldToRow
(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow) INTERNAL: Add abstract class indicator information to the database row.protected void
addClassIndicatorTypeToParent
(Object indicator) INTERNAL: Post initialize the child descriptorsvoid
addClassNameIndicator
(String childClassName, Object typeValue) INTERNAL: Add the class name reference by class name, used by the MW.protected void
addFieldsToParent
(Vector fields) INTERNAL: Recursively adds fields to all the parentsvoid
appendWithAllSubclassesExpression
(org.eclipse.persistence.internal.expressions.SQLSelectStatement selectStatement) INTERNAL: Append the branch with all subclasses expression to the statement.org.eclipse.persistence.internal.expressions.SQLSelectStatement
INTERNAL: Return a select statement that will be used to query the class indicators required to query.org.eclipse.persistence.internal.expressions.SQLSelectStatement
INTERNAL: Build a select statement for all subclasses on the view using the same selection criteria as the query.classFromRow
(org.eclipse.persistence.internal.sessions.AbstractRecord rowFromDatabase, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method is invoked only for the abstract descriptors.classFromValue
(Object classFieldValue, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method is used to turn the a raw database field value classFieldValue into a Class object.clone()
INTERNAL: Clone the policyvoid
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings.protected <T> Class<T>
convertClassNameToClass
(String className, ClassLoader classLoader) INTERNAL: Convert the given className to an actual class.void
PUBLIC: Set the descriptor to only read instance of itself when queried.void
PUBLIC: Set the descriptor not to use the class' full name as the indicator.INTERNAL: Stores class indicators for all child and children's children.INTERNAL: Returns all the child descriptors, even descriptors for subclasses of subclasses.protected List<ClassDescriptor>
getAllChildDescriptors
(List<ClassDescriptor> allChildDescriptors) INTERNAL: Recursive subroutine of getAllChildDescriptors.INTERNAL: all tables for reference class plus childrenTablesINTERNAL: Return all the immediate child descriptors.INTERNAL: all expressions from childrenTablesJoinExpressions ANDed togetherList<org.eclipse.persistence.internal.helper.DatabaseTable>
INTERNAL: if reads subclasses, all tables for all read subclasses (indirect included).Map<org.eclipse.persistence.internal.helper.DatabaseTable,
Expression> INTERNAL: join expression for each child table, keyed by the tableprotected Method
INTERNAL: Return all the classExtractionMethodADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism.ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism.INTERNAL: Return the class indicator associations for XML.org.eclipse.persistence.internal.helper.DatabaseField
INTERNAL: Returns field that the class type indicator is store when using inheritance.PUBLIC: Return the class indicator field name.INTERNAL: Return the association of indicators and classes using specified ConversionManagerprotected Object
INTERNAL: Returns value of the abstract class indicator for the Java class.protected Object
getClassIndicatorValue
(Class javaClass) INTERNAL: Returns the indicator field value for the given class If no abstract indicator mapping is specified, use the class name.INTERNAL: Return the mapping from class name to indicator, used by MW.boolean
ADVANCED: Determines whether the descriptors using this inheritance policy should be used as descriptors for subclasses of the classes they describe if those subclasses do not have their own descriptor e.g.INTERNAL: Returns the descriptor which the policy belongs to.getDescriptor
(Class theClass) INTERNAL: Returns descriptor corresponding to the class owning the policy or its subclass - otherwise null.ADVANCED: Return the 'only instances expression'.PUBLIC: Return the parent class.INTERNAL: Return the parent class name.INTERNAL: Return the parent descriptor.org.eclipse.persistence.internal.helper.DatabaseTable
INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables.ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables.INTERNAL: Return the root parent descriptorgetSubclassDescriptor
(Class theClass) INTERNAL: use aggregate in inheritanceboolean
INTERNAL: return if we should use the descriptor inheritance to determine if an object can be returned from the identity map or not.ADVANCED: Return the Expression which gets all subclasses.boolean
INTERNAL: Check if descriptor has childrenboolean
INTERNAL:boolean
INTERNAL: Checks if the class is involved in inheritanceboolean
INTERNAL: Return if any children of this descriptor require information from another table not specified at the parent level.boolean
hasView()
INTERNAL: Return if a view is used for inheritance reads.void
initialize
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize the inheritance properties of the descriptor once the mappings are initialized.protected void
INTERNAL: Potentially override the cache invalidation behaviorprotected void
initializeClassExtractor
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid.protected void
INTERNAL: Initialize the expression to use to check the specific type field.protected void
INTERNAL: Potentially override the optimistic locking behaviorprotected void
INTERNAL: Initialize the expression to use for queries to the class and its subclasses.boolean
INTERNAL: Check if it is a child descriptor.boolean
INTERNAL: Indicate whether a single table or joined inheritance strategy is being used.boolean
INTERNAL: Return whether or not is root parent descriptorvoid
postInitialize
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialized the inheritance properties that cannot be initialized until after the mappings have been.void
preInitialize
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Allow the inheritance properties of the descriptor to be initialized.void
PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried.void
remoteInitialization
(DistributedSession session) INTERNAL: Used to initialize a remote descriptor.protected void
removeChildren
(ClassDescriptor descriptor, Set<Class> classes, Set<Class> subclasses) Remove all of the subclasses (and so on) from the set of classes.boolean
INTERNAL: Return if this descriptor has children that define additional tables and needs to read them.protected Vector
INTERNAL: Select all rows from a abstract table descriptor.protected Vector
INTERNAL: Select all rows from a abstract table descriptor.INTERNAL: Select all rows from a abstract table descriptor.protected org.eclipse.persistence.internal.sessions.AbstractRecord
INTERNAL: Select one rows from a abstract table descriptor.protected org.eclipse.persistence.internal.sessions.AbstractRecord
INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only.org.eclipse.persistence.internal.sessions.AbstractRecord
INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only.protected void
setAllChildClassIndicators
(Vector allChildClassIndicators) INTERNAL:void
setAlwaysUseOuterJoinForClassType
(boolean choice) PUBLIC: Sets the inheritance policy to always use an outer join when querying across a relationship of class.void
setChildDescriptors
(List<ClassDescriptor> childDescriptors) INTERNAL:void
setClassExtractionMethodName
(String staticClassClassExtractionMethod) ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism.void
setClassExtractor
(ClassExtractor classExtractor) ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism.void
setClassExtractorName
(String classExtractorName) ADVANCED: Set the class extractor class name.void
setClassIndicatorAssociations
(Vector classIndicatorAssociations) INTERNAL: Set the class indicator associations from reading the deployment XML.void
setClassIndicatorField
(org.eclipse.persistence.internal.helper.DatabaseField classIndicatorField) ADVANCED: To set the class indicator field.void
setClassIndicatorFieldName
(String fieldName) PUBLIC: To set the class indicator field name.void
setClassIndicatorMapping
(Map classIndicatorMapping) PUBLIC: Set the association of indicators and classes.void
setClassNameIndicatorMapping
(Map classNameIndicatorMapping) INTERNAL: Set the class name indicator mapping, used by the MW.void
setDescribesNonPersistentSubclasses
(boolean describesNonPersistentSubclasses) ADVANCED: Determines whether the descriptors using this inheritance policy should be used as descriptors for subclasses of the classes they describe if those subclasses do not have their own descriptor e.g.void
setDescriptor
(ClassDescriptor descriptor) INTERNAL: Set the descriptor.void
INTERNAL: Used to indicate a JOINED inheritance strategy.void
setOnlyInstancesExpression
(Expression onlyInstancesExpression) ADVANCED: Sets the expression used to select instance of the class only.void
setParentClass
(Class parentClass) PUBLIC: Set the parent class.void
setParentClassName
(String parentClassName) INTERNAL: Set the parent class name, used by MW to avoid referencing the real class for deployment XML generation.void
setParentDescriptor
(ClassDescriptor parentDescriptor) INTERNAL:protected void
setReadAllSubclassesView
(org.eclipse.persistence.internal.helper.DatabaseTable readAllSubclassesView) INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables.void
setReadAllSubclassesViewName
(String readAllSubclassesViewName) ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables.void
setShouldOuterJoinSubclasses
(boolean shouldOuterJoinSubclasses) PUBLIC: Set if an outer join should be used to read subclasses.void
setShouldReadSubclasses
(boolean shouldReadSubclasses) PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried.void
setShouldReadSubclasses
(Boolean shouldReadSubclasses) INTERNAL: Set the descriptor to read instance of itself and its subclasses when queried.void
setShouldUseClassNameAsIndicator
(boolean shouldUseClassNameAsIndicator) PUBLIC: Set if the descriptor uses the classes fully qualified name as the indicator.void
INTERNAL: Used to indicate a SINGLE_TABLE inheritance strategy.void
setUseDescriptorsToValidateInheritedObjects
(boolean useDescriptorsToValidateInheritedObjects) INTERNAL: Sets if we should use the descriptor inheritance to determine if an object can be returned from the identity map or not.void
setWithAllSubclassesExpression
(Expression withAllSubclassesExpression) ADVANCED: Sets the expression to be used for querying for a class and all its subclasses.boolean
PUBLIC: returns if the inheritance policy will always use an outerjoin when selecting class typeboolean
PUBLIC: Return if an outer join should be used to read subclasses.boolean
PUBLIC: Return true if this descriptor should read instances of itself and subclasses on queries.INTERNAL: Return true if this descriptor should read instances of itself and subclasses on queries.boolean
PUBLIC: Return true if the descriptor use the classes full name as the indicator.toString()
INTERNAL:protected void
INTERNAL: set the tables on the child descriptor overridden in org.eclipse.persistence.internal.oxm.QNameInheritancePolicyvoid
PUBLIC: Set the descriptor to use the classes full name as the indicator.
-
Field Details
-
parentClass
-
parentClassName
-
parentDescriptor
-
childDescriptors
-
classIndicatorField
protected org.eclipse.persistence.internal.helper.DatabaseField classIndicatorField -
classIndicatorMapping
-
classNameIndicatorMapping
-
shouldUseClassNameAsIndicator
protected transient boolean shouldUseClassNameAsIndicator -
shouldReadSubclasses
-
readAllSubclassesView
protected org.eclipse.persistence.internal.helper.DatabaseTable readAllSubclassesView -
allChildClassIndicators
-
onlyInstancesExpression
-
withAllSubclassesExpression
-
allTables
-
childrenTables
-
childrenTablesJoinExpressions
protected transient Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression> childrenTablesJoinExpressions -
childrenJoinExpression
-
classExtractorName
Allow for class extraction method to be specified. -
classExtractor
-
descriptor
-
shouldAlwaysUseOuterJoin
protected boolean shouldAlwaysUseOuterJoin -
useDescriptorsToValidateInheritedObjects
protected boolean useDescriptorsToValidateInheritedObjects -
shouldOuterJoinSubclasses
protected boolean shouldOuterJoinSubclassesDefine if an outer join should be used to read subclasses. -
isJoinedStrategy
protected boolean isJoinedStrategy -
rootParentDescriptor
PERF: Cache root descriptor. -
describesNonPersistentSubclasses
protected boolean describesNonPersistentSubclasses
-
-
Constructor Details
-
InheritancePolicy
public InheritancePolicy()INTERNAL: Create a new policy. Only descriptors involved in inheritance should have a policy. -
InheritancePolicy
INTERNAL: Create a new policy. Only descriptors involved in inheritance should have a policy.
-
-
Method Details
-
addChildDescriptor
INTERNAL: Add child descriptor to the parent descriptor. -
addChildTableJoinExpression
protected void addChildTableJoinExpression(org.eclipse.persistence.internal.helper.DatabaseTable table, Expression expression) INTERNAL: childrenTablesJoinExpressions, childrenTables, allTables and childrenJoinExpression are created simultaneously and kept in sync. -
addChildTableJoinExpressionToAllParents
public void addChildTableJoinExpressionToAllParents(org.eclipse.persistence.internal.helper.DatabaseTable table, Expression expression) INTERNAL: call addChildTableJoinExpression on all parents -
addClassIndicator
PUBLIC: Add a class indicator for the root classes subclass. The indicator is used to determine the class to use for a row read from the database, and to query only instances of a class from the database. Every concrete persistent subclass must have a single unique indicator defined for it. If the root class is concrete then it must also define an indicator. Only the root class's descriptor of the entire inheritance hierarchy can define the class indicator mapping. -
addClassNameIndicator
INTERNAL: Add the class name reference by class name, used by the MW.- Specified by:
addClassNameIndicator
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
addClassIndicatorFieldToInsertRow
public void addClassIndicatorFieldToInsertRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow) INTERNAL: Add abstract class indicator information to the database row. This is required when building a row for an insert or an update of a concrete child descriptor. This is only used to build a template row. -
addClassIndicatorFieldToRow
public void addClassIndicatorFieldToRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow) INTERNAL: Add abstract class indicator information to the database row. This is required when building a row for an insert or an update of a concrete child descriptor.- Specified by:
addClassIndicatorFieldToRow
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
addClassIndicatorTypeToParent
INTERNAL: Post initialize the child descriptors -
addFieldsToParent
INTERNAL: Recursively adds fields to all the parents -
buildClassIndicatorSelectStatement
public org.eclipse.persistence.internal.expressions.SQLSelectStatement buildClassIndicatorSelectStatement(ObjectLevelReadQuery query) INTERNAL: Return a select statement that will be used to query the class indicators required to query. This is used in the abstract-multiple read. -
appendWithAllSubclassesExpression
public void appendWithAllSubclassesExpression(org.eclipse.persistence.internal.expressions.SQLSelectStatement selectStatement) INTERNAL: Append the branch with all subclasses expression to the statement. -
buildViewSelectStatement
public org.eclipse.persistence.internal.expressions.SQLSelectStatement buildViewSelectStatement(ObjectLevelReadQuery query) INTERNAL: Build a select statement for all subclasses on the view using the same selection criteria as the query. -
classFromRow
public Class classFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord rowFromDatabase, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: This method is invoked only for the abstract descriptors.- Specified by:
classFromRow
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField> - Throws:
DescriptorException
-
classFromValue
public Class classFromValue(Object classFieldValue, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: This method is used to turn the a raw database field value classFieldValue into a Class object. Used to determine which class objects to build from database results, and for class type expression- Throws:
DescriptorException
-
clone
INTERNAL: Clone the policy -
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes. It will also convert referenced classes to the versions of the classes from the classLoader. -
convertClassNameToClass
INTERNAL: Convert the given className to an actual class. -
dontReadSubclassesOnQueries
public void dontReadSubclassesOnQueries()PUBLIC: Set the descriptor to only read instance of itself when queried. This is used with inheritance to configure the result of queries. By default this is true for root inheritance descriptors, and false for all others. -
dontUseClassNameAsIndicator
public void dontUseClassNameAsIndicator()PUBLIC: Set the descriptor not to use the class' full name as the indicator. The class indicator is used with inheritance to determine the class from a row. By default a class indicator mapping is required, this can be set to true if usage of the class name is desired. The field must be of a large enough size to store the fully qualified class name. -
getAllChildClassIndicators
INTERNAL: Stores class indicators for all child and children's children. Used for queries on branch classes only. -
getAllChildDescriptors
INTERNAL: Returns all the child descriptors, even descriptors for subclasses of subclasses. Required for bug 3019934.- Specified by:
getAllChildDescriptors
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getAllChildDescriptors
INTERNAL: Recursive subroutine of getAllChildDescriptors. -
getChildrenTables
INTERNAL: if reads subclasses, all tables for all read subclasses (indirect included). -
getChildrenTablesJoinExpressions
public Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression> getChildrenTablesJoinExpressions()INTERNAL: join expression for each child table, keyed by the table -
getChildrenJoinExpression
INTERNAL: all expressions from childrenTablesJoinExpressions ANDed together -
getAllTables
INTERNAL: all tables for reference class plus childrenTables -
getChildDescriptors
INTERNAL: Return all the immediate child descriptors. Only descriptors from direct subclasses are returned. -
getClassExtractionMethod
INTERNAL: Return all the classExtractionMethod -
getClassExtractionMethodName
ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. This allows for a user defined class indicator in place of providing an explicit class indicator field. The method registered must be a static method on the class which has that descriptor. The method must take a Record as an argument (for example, a DatabaseRecord), and must return the class to use for that record. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the record. If this method is used, then the class indicator field and mapping cannot be used, and in addition, the descriptor's withAllSubclasses and onlyInstances expressions must also be setup correctly. -
getClassExtractor
ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism. This allows for a user defined class indicator in place of providing an explicit class indicator field. The instance registered must extend the ClassExtractor class and implement the extractClass(Map) method. The method must take database row (a Record/Map) as an argument and must return the class to use for that row. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the row, such as usage of a direct or transformation mapping for the type fields. If this method is used then the class indicator field and mapping cannot be used, and in addition, the descriptor's withAllSubclasses and onlyInstances expressions must also be setup correctly. -
setClassExtractor
ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism. This allows for a user defined class indicator in place of providing an explicit class indicator field. The instance registered must extend the ClassExtractor class and implement the extractClass(Map) method. The method must take database row (a Record/Map) as an argument and must return the class to use for that row. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the row, such as usage of a direct or transformation mapping for the type fields. If this method is used then the class indicator field and mapping cannot be used, and in addition, the descriptor's withAllSubclasses and onlyInstances expressions must also be setup correctly. -
setClassExtractorName
ADVANCED: Set the class extractor class name. At descriptor initialize time this class will be converted to a Class and set as the ClassExtractor. This method is called from JPA.- Specified by:
setClassExtractorName
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField> - See Also:
-
getClassIndicatorAssociations
INTERNAL: Return the class indicator associations for XML. List of class-name/value associations. -
getClassIndicatorField
public org.eclipse.persistence.internal.helper.DatabaseField getClassIndicatorField()INTERNAL: Returns field that the class type indicator is store when using inheritance.- Specified by:
getClassIndicatorField
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getClassIndicatorFieldName
PUBLIC: Return the class indicator field name. This is the name of the field in the table that stores what type of object this is.- Specified by:
getClassIndicatorFieldName
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getClassIndicatorMapping
INTERNAL: Return the association of indicators and classes using specified ConversionManager- Specified by:
getClassIndicatorMapping
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getClassNameIndicatorMapping
INTERNAL: Return the mapping from class name to indicator, used by MW.- Specified by:
getClassNameIndicatorMapping
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getClassIndicatorValue
INTERNAL: Returns value of the abstract class indicator for the Java class. -
getClassIndicatorValue
INTERNAL: Returns the indicator field value for the given class If no abstract indicator mapping is specified, use the class name. -
getDescriptor
INTERNAL: Returns the descriptor which the policy belongs to.- Specified by:
getDescriptor
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getDescribesNonPersistentSubclasses
public boolean getDescribesNonPersistentSubclasses()ADVANCED: Determines whether the descriptors using this inheritance policy should be used as descriptors for subclasses of the classes they describe if those subclasses do not have their own descriptor e.g. If Employee.class has a descriptor and EmployeeSubClass does not have a descriptor, if describesNonPersistenceSubclasses is true Employee's descriptor will be used as the descriptor for Employee -
getOnlyInstancesExpression
ADVANCED: Return the 'only instances expression'. -
getParentClass
PUBLIC: Return the parent class.- Specified by:
getParentClass
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getParentClassName
INTERNAL: Return the parent class name. -
getParentDescriptor
INTERNAL: Return the parent descriptor.- Specified by:
getParentDescriptor
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
getReadAllSubclassesView
public org.eclipse.persistence.internal.helper.DatabaseTable getReadAllSubclassesView()INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. This view can do the outer join, we require the view because we cannot generate dynamic platform independent SQL for outer joins (i.e. not possible to do so either). -
getReadAllSubclassesViewName
ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. This view can use outer joins or unions to combine the results of selecting from all of the subclass tables. If a view is not given then TopLink must make an individual call for each subclass. -
getRootParentDescriptor
INTERNAL: Return the root parent descriptor -
getSubclassDescriptor
INTERNAL: use aggregate in inheritance -
getDescriptor
INTERNAL: Returns descriptor corresponding to the class owning the policy or its subclass - otherwise null. -
getUseDescriptorsToValidateInheritedObjects
public boolean getUseDescriptorsToValidateInheritedObjects()INTERNAL: return if we should use the descriptor inheritance to determine if an object can be returned from the identity map or not. -
getWithAllSubclassesExpression
ADVANCED: Return the Expression which gets all subclasses. -
hasChildren
public boolean hasChildren()INTERNAL: Check if descriptor has children -
hasClassExtractor
public boolean hasClassExtractor()INTERNAL:- Specified by:
hasClassExtractor
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
hasClassIndicator
public boolean hasClassIndicator()INTERNAL: Checks if the class is involved in inheritance -
hasMultipleTableChild
public boolean hasMultipleTableChild()INTERNAL: Return if any children of this descriptor require information from another table not specified at the parent level. -
hasView
public boolean hasView()INTERNAL: Return if a view is used for inheritance reads. -
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize the inheritance properties of the descriptor once the mappings are initialized. This is done before formal postInitialize during the end of mapping initialize. -
initializeClassExtractor
protected void initializeClassExtractor(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid.- Throws:
DescriptorException
-
initializeOnlyInstancesExpression
INTERNAL: Initialize the expression to use to check the specific type field.- Throws:
DescriptorException
-
initializeOptimisticLocking
protected void initializeOptimisticLocking()INTERNAL: Potentially override the optimistic locking behavior -
initializeCacheInvalidationPolicy
protected void initializeCacheInvalidationPolicy()INTERNAL: Potentially override the cache invalidation behavior -
initializeWithAllSubclassesExpression
INTERNAL: Initialize the expression to use for queries to the class and its subclasses.- Throws:
DescriptorException
-
isChildDescriptor
public boolean isChildDescriptor()INTERNAL: Check if it is a child descriptor. -
isJoinedStrategy
public boolean isJoinedStrategy()INTERNAL: Indicate whether a single table or joined inheritance strategy is being used. Since we currently do not support TABLE_PER_CLASS, indicating either joined/not joined is sufficient.- Returns:
- isJoinedStrategy value
-
isRootParentDescriptor
public boolean isRootParentDescriptor()INTERNAL: Return whether or not is root parent descriptor- Specified by:
isRootParentDescriptor
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
postInitialize
public void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialized the inheritance properties that cannot be initialized until after the mappings have been. -
preInitialize
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: Allow the inheritance properties of the descriptor to be initialized. The descriptor's parent must first be initialized.- Throws:
DescriptorException
-
readSubclassesOnQueries
public void readSubclassesOnQueries()PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried. This is used with inheritance to configure the result of queries. By default this is true for root inheritance descriptors, and false for all others. -
remoteInitialization
INTERNAL: Used to initialize a remote descriptor. -
requiresMultipleTableSubclassRead
public boolean requiresMultipleTableSubclassRead()INTERNAL: Return if this descriptor has children that define additional tables and needs to read them. This case requires a special read, because the query cannot be done through a single SQL call with normal joins. -
selectAllRowUsingCustomMultipleTableSubclassRead
protected Vector selectAllRowUsingCustomMultipleTableSubclassRead(ObjectLevelReadQuery query) throws DatabaseException INTERNAL: Select all rows from a abstract table descriptor. This is accomplished by selecting for all of the concrete classes and then merging the rows. This does not optimize using type select, as the type information is not known.- Returns:
- vector containing database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectAllRowUsingDefaultMultipleTableSubclassRead
protected Vector selectAllRowUsingDefaultMultipleTableSubclassRead(ObjectLevelReadQuery query) throws DatabaseException, QueryException INTERNAL: Select all rows from a abstract table descriptor. This is accomplished by selecting for all of the concrete classes and then merging the rows.- Returns:
- vector containing database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.QueryException
-
removeChildren
protected void removeChildren(ClassDescriptor descriptor, Set<Class> classes, Set<Class> subclasses) Remove all of the subclasses (and so on) from the set of classes. -
selectAllRowUsingMultipleTableSubclassRead
public Vector selectAllRowUsingMultipleTableSubclassRead(ObjectLevelReadQuery query) throws DatabaseException INTERNAL: Select all rows from a abstract table descriptor. This is accomplished by selecting for all of the concrete classes and then merging the rows.- Returns:
- vector containing database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectOneRowUsingCustomMultipleTableSubclassRead
protected org.eclipse.persistence.internal.sessions.AbstractRecord selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException INTERNAL: Select one rows from a abstract table descriptor. This is accomplished by selecting for all of the concrete classes until a row is found. This does not optimize using type select, as the type information is not known.- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectOneRowUsingDefaultMultipleTableSubclassRead
protected org.eclipse.persistence.internal.sessions.AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only.- Throws:
DatabaseException
QueryException
-
selectOneRowUsingMultipleTableSubclassRead
public org.eclipse.persistence.internal.sessions.AbstractRecord selectOneRowUsingMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only.- Throws:
DatabaseException
QueryException
-
setAllChildClassIndicators
INTERNAL: -
setChildDescriptors
INTERNAL: -
setClassExtractionMethodName
ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. This allows for a user defined class indicator in place of providing an explicit class indicator field. The method registered must be a static method on the class which has that descriptor. The method must take Record as an argument (for example, a DatabaseRecord), and must return the class to use for that record. This method will be used to decide which class to instantiate when reading from the database. It is the application's responsibility to populate any typing information in the database required to determine the class from the record. If this method is used then the class indicator field and mapping cannot be used, and in addition, the descriptor's withAllSubclasses and onlyInstances expressions must also be set up correctly. -
setClassIndicatorAssociations
INTERNAL: Set the class indicator associations from reading the deployment XML. -
setClassIndicatorField
public void setClassIndicatorField(org.eclipse.persistence.internal.helper.DatabaseField classIndicatorField) ADVANCED: To set the class indicator field. This can be used for advanced field types, such as XML nodes, or to set the field type.- Specified by:
setClassIndicatorField
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
setClassIndicatorFieldName
PUBLIC: To set the class indicator field name. This is the name of the field in the table that stores what type of object this is. -
setClassIndicatorMapping
PUBLIC: Set the association of indicators and classes. This may be desired to be used by clients in strange inheritance models.- Specified by:
setClassIndicatorMapping
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
setClassNameIndicatorMapping
INTERNAL: Set the class name indicator mapping, used by the MW. -
setDescriptor
INTERNAL: Set the descriptor.- Specified by:
setDescriptor
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
setDescribesNonPersistentSubclasses
public void setDescribesNonPersistentSubclasses(boolean describesNonPersistentSubclasses) ADVANCED: Determines whether the descriptors using this inheritance policy should be used as descriptors for subclasses of the classes they describe if those subclasses do not have their own descriptor e.g. If Employee.class has a descriptor and EmployeeSubClass does not have a descriptor, if describesNonPersistenceSubclasses is true Employee's descriptor will be used as the descriptor for Employee- Parameters:
describesNonPersistentSubclasses
-
-
setJoinedStrategy
public void setJoinedStrategy()INTERNAL: Used to indicate a JOINED inheritance strategy. -
setOnlyInstancesExpression
ADVANCED: Sets the expression used to select instance of the class only. Can be used to customize the inheritance class indicator expression. -
setParentClass
PUBLIC: Set the parent class. A descriptor can inherit from another descriptor through defining it as its parent. The root descriptor must define a class indicator field and mapping. All children must share the same table as their parent but can add additional tables. All children must share the root descriptor primary key. -
setParentClassName
INTERNAL: Set the parent class name, used by MW to avoid referencing the real class for deployment XML generation.- Specified by:
setParentClassName
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
setParentDescriptor
INTERNAL: -
setReadAllSubclassesView
protected void setReadAllSubclassesView(org.eclipse.persistence.internal.helper.DatabaseTable readAllSubclassesView) INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. This view can do the outer join, we require the view because we cannot generate dynamic platform independent SQL for outer joins (i.e. not possible to do so either). -
setReadAllSubclassesViewName
ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. This view can use outer joins or unions to combine the results of selecting from all of the subclass tables. If a view is not given then TopLink must make an individual call for each subclass. -
setShouldReadSubclasses
INTERNAL: Set the descriptor to read instance of itself and its subclasses when queried. This is used with inheritance to configure the result of queries. By default this is true for root inheritance descriptors, and false for all others.- Specified by:
setShouldReadSubclasses
in classCoreInheritancePolicy<org.eclipse.persistence.internal.sessions.AbstractRecord,
org.eclipse.persistence.internal.sessions.AbstractSession, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField>
-
setShouldReadSubclasses
public void setShouldReadSubclasses(boolean shouldReadSubclasses) PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried. This is used with inheritance to configure the result of queries. By default this is true for root inheritance descriptors, and false for all others. -
setShouldUseClassNameAsIndicator
public void setShouldUseClassNameAsIndicator(boolean shouldUseClassNameAsIndicator) PUBLIC: Set if the descriptor uses the classes fully qualified name as the indicator. The class indicator is used with inheritance to determine the class from a row. By default a class indicator mapping is required, this can be set to true if usage of the class name is desired. The field must be of a large enough size to store the fully qualified class name. -
setAlwaysUseOuterJoinForClassType
public void setAlwaysUseOuterJoinForClassType(boolean choice) PUBLIC: Sets the inheritance policy to always use an outer join when querying across a relationship of class. used when using getAllowingNull(), or anyOfAllowingNone() -
setSingleTableStrategy
public void setSingleTableStrategy()INTERNAL: Used to indicate a SINGLE_TABLE inheritance strategy. Since only JOINED and SINGLE_TABLE strategies are supported at this time (no support for TABLE_PER_CLASS) using a !isJoinedStrategy an an indicator for SINGLE_TABLE is sufficient. -
setUseDescriptorsToValidateInheritedObjects
public void setUseDescriptorsToValidateInheritedObjects(boolean useDescriptorsToValidateInheritedObjects) INTERNAL: Sets if we should use the descriptor inheritance to determine if an object can be returned from the identity map or not. -
setWithAllSubclassesExpression
ADVANCED: Sets the expression to be used for querying for a class and all its subclasses. Can be used to customize the inheritance class indicator expression. -
shouldReadSubclasses
public boolean shouldReadSubclasses()PUBLIC: Return true if this descriptor should read instances of itself and subclasses on queries. -
shouldReadSubclassesValue
INTERNAL: Return true if this descriptor should read instances of itself and subclasses on queries. -
shouldAlwaysUseOuterJoin
public boolean shouldAlwaysUseOuterJoin()PUBLIC: returns if the inheritance policy will always use an outerjoin when selecting class type -
shouldOuterJoinSubclasses
public boolean shouldOuterJoinSubclasses()PUBLIC: Return if an outer join should be used to read subclasses. By default a separate query is done for each subclass when querying for a root or branch inheritance class that has subclasses that span multiple tables. -
setShouldOuterJoinSubclasses
public void setShouldOuterJoinSubclasses(boolean shouldOuterJoinSubclasses) PUBLIC: Set if an outer join should be used to read subclasses. By default a separate query is done for each subclass when querying for a root or branch inheritance class that has subclasses that span multiple tables. -
shouldUseClassNameAsIndicator
public boolean shouldUseClassNameAsIndicator()PUBLIC: Return true if the descriptor use the classes full name as the indicator. The class indicator is used with inheritance to determine the class from a row. By default a class indicator mapping is required, this can be set to true if usage of the class name is desired. The field must be of a large enough size to store the fully qualified class name. -
toString
INTERNAL: -
updateTables
protected void updateTables()INTERNAL: set the tables on the child descriptor overridden in org.eclipse.persistence.internal.oxm.QNameInheritancePolicy -
useClassNameAsIndicator
public void useClassNameAsIndicator()PUBLIC: Set the descriptor to use the classes full name as the indicator. The class indicator is used with inheritance to determine the class from a row. By default a class indicator mapping is required, this can be set to true if usage of the class name is desired. The field must be of a large enough size to store the fully qualified class name.
-