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:
java.io.Serializable
,java.lang.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 java.io.Serializable, java.lang.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Object>
allChildClassIndicators
protected java.util.Vector
allTables
protected java.util.List<ClassDescriptor>
childDescriptors
protected Expression
childrenJoinExpression
protected java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable>
childrenTables
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression>
childrenTablesJoinExpressions
protected ClassExtractor
classExtractor
protected java.lang.String
classExtractorName
Allow for class extraction method to be specified.protected org.eclipse.persistence.internal.helper.DatabaseField
classIndicatorField
protected java.util.Map
classIndicatorMapping
protected java.util.Map
classNameIndicatorMapping
protected boolean
describesNonPersistentSubclasses
protected ClassDescriptor
descriptor
protected boolean
isJoinedStrategy
protected Expression
onlyInstancesExpression
protected java.lang.Class
parentClass
protected java.lang.String
parentClassName
protected ClassDescriptor
parentDescriptor
protected org.eclipse.persistence.internal.helper.DatabaseTable
readAllSubclassesView
protected ClassDescriptor
rootParentDescriptor
PERF: Cache root descriptor.protected boolean
shouldAlwaysUseOuterJoin
protected boolean
shouldOuterJoinSubclasses
Define if an outer join should be used to read subclasses.protected java.lang.Boolean
shouldReadSubclasses
protected boolean
shouldUseClassNameAsIndicator
protected boolean
useDescriptorsToValidateInheritedObjects
protected Expression
withAllSubclassesExpression
-
Constructor Summary
Constructors Constructor Description InheritancePolicy()
INTERNAL: Create a new policy.InheritancePolicy(ClassDescriptor descriptor)
INTERNAL: Create a new policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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(java.lang.Class childClass, java.lang.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(java.lang.Object indicator)
INTERNAL: Post initialize the child descriptorsvoid
addClassNameIndicator(java.lang.String childClassName, java.lang.Object typeValue)
INTERNAL: Add the class name reference by class name, used by the MW.protected void
addFieldsToParent(java.util.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
buildClassIndicatorSelectStatement(ObjectLevelReadQuery query)
INTERNAL: Return a select statement that will be used to query the class indicators required to query.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.java.lang.Class
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.java.lang.Class
classFromValue(java.lang.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.java.lang.Object
clone()
INTERNAL: Clone the policyvoid
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings.protected java.lang.Class
convertClassNameToClass(java.lang.String className, java.lang.ClassLoader classLoader)
INTERNAL: Convert the given className to an actual class.void
dontReadSubclassesOnQueries()
PUBLIC: Set the descriptor to only read instance of itself when queried.void
dontUseClassNameAsIndicator()
PUBLIC: Set the descriptor not to use the class' full name as the indicator.protected java.util.List<java.lang.Object>
getAllChildClassIndicators()
INTERNAL: Stores class indicators for all child and children's children.java.util.List<ClassDescriptor>
getAllChildDescriptors()
INTERNAL: Returns all the child descriptors, even descriptors for subclasses of subclasses.protected java.util.List<ClassDescriptor>
getAllChildDescriptors(java.util.List<ClassDescriptor> allChildDescriptors)
INTERNAL: Recursive subroutine of getAllChildDescriptors.java.util.Vector
getAllTables()
INTERNAL: all tables for reference class plus childrenTablesjava.util.List<ClassDescriptor>
getChildDescriptors()
INTERNAL: Return all the immediate child descriptors.Expression
getChildrenJoinExpression()
INTERNAL: all expressions from childrenTablesJoinExpressions ANDed togetherjava.util.List<org.eclipse.persistence.internal.helper.DatabaseTable>
getChildrenTables()
INTERNAL: if reads subclasses, all tables for all read subclasses (indirect included).java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression>
getChildrenTablesJoinExpressions()
INTERNAL: join expression for each child table, keyed by the tableprotected java.lang.reflect.Method
getClassExtractionMethod()
INTERNAL: Return all the classExtractionMethodjava.lang.String
getClassExtractionMethodName()
ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism.ClassExtractor
getClassExtractor()
ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism.java.util.Vector
getClassIndicatorAssociations()
INTERNAL: Return the class indicator associations for XML.org.eclipse.persistence.internal.helper.DatabaseField
getClassIndicatorField()
INTERNAL: Returns field that the class type indicator is store when using inheritance.java.lang.String
getClassIndicatorFieldName()
PUBLIC: Return the class indicator field name.java.util.Map
getClassIndicatorMapping()
INTERNAL: Return the association of indicators and classes using specified ConversionManagerprotected java.lang.Object
getClassIndicatorValue()
INTERNAL: Returns value of the abstract class indicator for the Java class.protected java.lang.Object
getClassIndicatorValue(java.lang.Class javaClass)
INTERNAL: Returns the indicator field value for the given class If no abstract indicator mapping is specified, use the class name.java.util.Map
getClassNameIndicatorMapping()
INTERNAL: Return the mapping from class name to indicator, used by MW.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.ClassDescriptor
getDescriptor()
INTERNAL: Returns the descriptor which the policy belongs to.ClassDescriptor
getDescriptor(java.lang.Class theClass)
INTERNAL: Returns descriptor corresponding to the class owning the policy or its subclass - otherwise null.Expression
getOnlyInstancesExpression()
ADVANCED: Return the 'only instances expression'.java.lang.Class
getParentClass()
PUBLIC: Return the parent class.java.lang.String
getParentClassName()
INTERNAL: Return the parent class name.ClassDescriptor
getParentDescriptor()
INTERNAL: Return the parent descriptor.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.java.lang.String
getReadAllSubclassesViewName()
ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables.ClassDescriptor
getRootParentDescriptor()
INTERNAL: Return the root parent descriptorClassDescriptor
getSubclassDescriptor(java.lang.Class theClass)
INTERNAL: use aggregate in inheritanceboolean
getUseDescriptorsToValidateInheritedObjects()
INTERNAL: return if we should use the descriptor inheritance to determine if an object can be returned from the identity map or not.Expression
getWithAllSubclassesExpression()
ADVANCED: Return the Expression which gets all subclasses.boolean
hasChildren()
INTERNAL: Check if descriptor has childrenboolean
hasClassExtractor()
INTERNAL:boolean
hasClassIndicator()
INTERNAL: Checks if the class is involved in inheritanceboolean
hasMultipleTableChild()
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
initializeCacheInvalidationPolicy()
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
initializeOnlyInstancesExpression()
INTERNAL: Initialize the expression to use to check the specific type field.protected void
initializeOptimisticLocking()
INTERNAL: Potentially override the optimistic locking behaviorprotected void
initializeWithAllSubclassesExpression()
INTERNAL: Initialize the expression to use for queries to the class and its subclasses.boolean
isChildDescriptor()
INTERNAL: Check if it is a child descriptor.boolean
isJoinedStrategy()
INTERNAL: Indicate whether a single table or joined inheritance strategy is being used.boolean
isRootParentDescriptor()
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
readSubclassesOnQueries()
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, java.util.Set<java.lang.Class> classes, java.util.Set<java.lang.Class> subclasses)
Remove all of the subclasses (and so on) from the set of classes.boolean
requiresMultipleTableSubclassRead()
INTERNAL: Return if this descriptor has children that define additional tables and needs to read them.protected java.util.Vector
selectAllRowUsingCustomMultipleTableSubclassRead(ObjectLevelReadQuery query)
INTERNAL: Select all rows from a abstract table descriptor.protected java.util.Vector
selectAllRowUsingDefaultMultipleTableSubclassRead(ObjectLevelReadQuery query)
INTERNAL: Select all rows from a abstract table descriptor.java.util.Vector
selectAllRowUsingMultipleTableSubclassRead(ObjectLevelReadQuery query)
INTERNAL: Select all rows from a abstract table descriptor.protected org.eclipse.persistence.internal.sessions.AbstractRecord
selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query)
INTERNAL: Select one rows from a abstract table descriptor.protected org.eclipse.persistence.internal.sessions.AbstractRecord
selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query)
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
selectOneRowUsingMultipleTableSubclassRead(ReadObjectQuery query)
INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only.protected void
setAllChildClassIndicators(java.util.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(java.util.List<ClassDescriptor> childDescriptors)
INTERNAL:void
setClassExtractionMethodName(java.lang.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(java.lang.String classExtractorName)
ADVANCED: Set the class extractor class name.void
setClassIndicatorAssociations(java.util.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(java.lang.String fieldName)
PUBLIC: To set the class indicator field name.void
setClassIndicatorMapping(java.util.Map classIndicatorMapping)
PUBLIC: Set the association of indicators and classes.void
setClassNameIndicatorMapping(java.util.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
setJoinedStrategy()
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(java.lang.Class parentClass)
PUBLIC: Set the parent class.void
setParentClassName(java.lang.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(java.lang.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(java.lang.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
setSingleTableStrategy()
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
shouldAlwaysUseOuterJoin()
PUBLIC: returns if the inheritance policy will always use an outerjoin when selecting class typeboolean
shouldOuterJoinSubclasses()
PUBLIC: Return if an outer join should be used to read subclasses.boolean
shouldReadSubclasses()
PUBLIC: Return true if this descriptor should read instances of itself and subclasses on queries.java.lang.Boolean
shouldReadSubclassesValue()
INTERNAL: Return true if this descriptor should read instances of itself and subclasses on queries.boolean
shouldUseClassNameAsIndicator()
PUBLIC: Return true if the descriptor use the classes full name as the indicator.java.lang.String
toString()
INTERNAL:protected void
updateTables()
INTERNAL: set the tables on the child descriptor overridden in org.eclipse.persistence.internal.oxm.QNameInheritancePolicyvoid
useClassNameAsIndicator()
PUBLIC: Set the descriptor to use the classes full name as the indicator.
-
-
-
Field Detail
-
parentClass
protected java.lang.Class parentClass
-
parentClassName
protected java.lang.String parentClassName
-
parentDescriptor
protected ClassDescriptor parentDescriptor
-
childDescriptors
protected java.util.List<ClassDescriptor> childDescriptors
-
classIndicatorField
protected org.eclipse.persistence.internal.helper.DatabaseField classIndicatorField
-
classIndicatorMapping
protected transient java.util.Map classIndicatorMapping
-
classNameIndicatorMapping
protected java.util.Map classNameIndicatorMapping
-
shouldUseClassNameAsIndicator
protected transient boolean shouldUseClassNameAsIndicator
-
shouldReadSubclasses
protected transient java.lang.Boolean shouldReadSubclasses
-
readAllSubclassesView
protected org.eclipse.persistence.internal.helper.DatabaseTable readAllSubclassesView
-
allChildClassIndicators
protected transient java.util.List<java.lang.Object> allChildClassIndicators
-
onlyInstancesExpression
protected transient Expression onlyInstancesExpression
-
withAllSubclassesExpression
protected transient Expression withAllSubclassesExpression
-
allTables
protected transient java.util.Vector allTables
-
childrenTables
protected transient java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable> childrenTables
-
childrenTablesJoinExpressions
protected transient java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression> childrenTablesJoinExpressions
-
childrenJoinExpression
protected transient Expression childrenJoinExpression
-
classExtractorName
protected java.lang.String classExtractorName
Allow for class extraction method to be specified.
-
classExtractor
protected transient ClassExtractor classExtractor
-
descriptor
protected ClassDescriptor descriptor
-
shouldAlwaysUseOuterJoin
protected boolean shouldAlwaysUseOuterJoin
-
useDescriptorsToValidateInheritedObjects
protected boolean useDescriptorsToValidateInheritedObjects
-
shouldOuterJoinSubclasses
protected boolean shouldOuterJoinSubclasses
Define if an outer join should be used to read subclasses.
-
isJoinedStrategy
protected boolean isJoinedStrategy
-
rootParentDescriptor
protected ClassDescriptor rootParentDescriptor
PERF: Cache root descriptor.
-
describesNonPersistentSubclasses
protected boolean describesNonPersistentSubclasses
-
-
Constructor Detail
-
InheritancePolicy
public InheritancePolicy()
INTERNAL: Create a new policy. Only descriptors involved in inheritance should have a policy.
-
InheritancePolicy
public InheritancePolicy(ClassDescriptor descriptor)
INTERNAL: Create a new policy. Only descriptors involved in inheritance should have a policy.
-
-
Method Detail
-
addChildDescriptor
public void addChildDescriptor(ClassDescriptor childDescriptor)
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 void addClassIndicator(java.lang.Class childClass, java.lang.Object typeValue)
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
public void addClassNameIndicator(java.lang.String childClassName, java.lang.Object typeValue)
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
protected void addClassIndicatorTypeToParent(java.lang.Object indicator)
INTERNAL: Post initialize the child descriptors
-
addFieldsToParent
protected void addFieldsToParent(java.util.Vector fields)
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 java.lang.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 java.lang.Class classFromValue(java.lang.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
public java.lang.Object clone()
INTERNAL: Clone the policy- Overrides:
clone
in classjava.lang.Object
-
convertClassNamesToClasses
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
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
protected java.lang.Class convertClassNameToClass(java.lang.String className, java.lang.ClassLoader classLoader)
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
protected java.util.List<java.lang.Object> getAllChildClassIndicators()
INTERNAL: Stores class indicators for all child and children's children. Used for queries on branch classes only.
-
getAllChildDescriptors
public java.util.List<ClassDescriptor> 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
protected java.util.List<ClassDescriptor> getAllChildDescriptors(java.util.List<ClassDescriptor> allChildDescriptors)
INTERNAL: Recursive subroutine of getAllChildDescriptors.
-
getChildrenTables
public java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable> getChildrenTables()
INTERNAL: if reads subclasses, all tables for all read subclasses (indirect included).
-
getChildrenTablesJoinExpressions
public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseTable,Expression> getChildrenTablesJoinExpressions()
INTERNAL: join expression for each child table, keyed by the table
-
getChildrenJoinExpression
public Expression getChildrenJoinExpression()
INTERNAL: all expressions from childrenTablesJoinExpressions ANDed together
-
getAllTables
public java.util.Vector getAllTables()
INTERNAL: all tables for reference class plus childrenTables
-
getChildDescriptors
public java.util.List<ClassDescriptor> getChildDescriptors()
INTERNAL: Return all the immediate child descriptors. Only descriptors from direct subclasses are returned.
-
getClassExtractionMethod
protected java.lang.reflect.Method getClassExtractionMethod()
INTERNAL: Return all the classExtractionMethod
-
getClassExtractionMethodName
public java.lang.String 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
public ClassExtractor 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
public void setClassExtractor(ClassExtractor classExtractor)
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
public void setClassExtractorName(java.lang.String classExtractorName)
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:
setClassExtractor for more information on the ClassExtractor class.
-
getClassIndicatorAssociations
public java.util.Vector 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 java.lang.String 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
public java.util.Map 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
public java.util.Map 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
protected java.lang.Object getClassIndicatorValue()
INTERNAL: Returns value of the abstract class indicator for the Java class.
-
getClassIndicatorValue
protected java.lang.Object getClassIndicatorValue(java.lang.Class javaClass)
INTERNAL: Returns the indicator field value for the given class If no abstract indicator mapping is specified, use the class name.
-
getDescriptor
public ClassDescriptor 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
public Expression getOnlyInstancesExpression()
ADVANCED: Return the 'only instances expression'.
-
getParentClass
public java.lang.Class 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
public java.lang.String getParentClassName()
INTERNAL: Return the parent class name.
-
getParentDescriptor
public ClassDescriptor 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
public java.lang.String 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
public ClassDescriptor getRootParentDescriptor()
INTERNAL: Return the root parent descriptor
-
getSubclassDescriptor
public ClassDescriptor getSubclassDescriptor(java.lang.Class theClass)
INTERNAL: use aggregate in inheritance
-
getDescriptor
public ClassDescriptor getDescriptor(java.lang.Class theClass)
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
public Expression 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
protected void initializeOnlyInstancesExpression() throws DescriptorException
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
protected void initializeWithAllSubclassesExpression() throws DescriptorException
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
public void remoteInitialization(DistributedSession session)
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 java.util.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 java.util.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, java.util.Set<java.lang.Class> classes, java.util.Set<java.lang.Class> subclasses)
Remove all of the subclasses (and so on) from the set of classes.
-
selectAllRowUsingMultipleTableSubclassRead
public java.util.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
protected void setAllChildClassIndicators(java.util.Vector allChildClassIndicators)
INTERNAL:
-
setChildDescriptors
public void setChildDescriptors(java.util.List<ClassDescriptor> childDescriptors)
INTERNAL:
-
setClassExtractionMethodName
public void setClassExtractionMethodName(java.lang.String staticClassClassExtractionMethod)
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
public void setClassIndicatorAssociations(java.util.Vector classIndicatorAssociations)
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 void setClassIndicatorFieldName(java.lang.String fieldName)
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 void setClassIndicatorMapping(java.util.Map classIndicatorMapping)
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
public void setClassNameIndicatorMapping(java.util.Map classNameIndicatorMapping)
INTERNAL: Set the class name indicator mapping, used by the MW.
-
setDescriptor
public void setDescriptor(ClassDescriptor descriptor)
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
public void setOnlyInstancesExpression(Expression onlyInstancesExpression)
ADVANCED: Sets the expression used to select instance of the class only. Can be used to customize the inheritance class indicator expression.
-
setParentClass
public void setParentClass(java.lang.Class parentClass)
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
public void setParentClassName(java.lang.String parentClassName)
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
public void setParentDescriptor(ClassDescriptor parentDescriptor)
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
public void setReadAllSubclassesViewName(java.lang.String readAllSubclassesViewName)
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
public void setShouldReadSubclasses(java.lang.Boolean shouldReadSubclasses)
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
public void setWithAllSubclassesExpression(Expression withAllSubclassesExpression)
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
public java.lang.Boolean 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
public java.lang.String toString()
INTERNAL:- Overrides:
toString
in classjava.lang.Object
-
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.
-
-