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.
| Modifier and Type | Field and Description |
|---|---|
| protected transient List | |
| protected transient Vector | |
| protected List | |
| protected transient Expression | |
| protected transient List | |
| protected transient Map | |
| protected transient ClassExtractor | |
| protected String | classExtractorName
Allow for class extraction method to be specified. |
| protected DatabaseField | |
| protected transient Map | |
| protected Map | |
| protected boolean | |
| protected ClassDescriptor | |
| protected boolean | |
| protected transient Expression | |
| protected Class | |
| protected String | |
| protected ClassDescriptor | |
| protected DatabaseTable | |
| protected ClassDescriptor | rootParentDescriptor
PERF: Cache root descriptor. |
| protected boolean | |
| protected boolean | shouldOuterJoinSubclasses
Define if an outer join should be used to read subclasses. |
| protected transient Boolean | |
| protected transient boolean | |
| protected boolean | |
| protected transient Expression |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addChildDescriptor(ClassDescriptor childDescriptor)
INTERNAL: Add child descriptor to the parent descriptor. |
| protected void | addChildTableJoinExpression(DatabaseTable table, Expression expression)
INTERNAL: childrenTablesJoinExpressions, childrenTables, allTables and childrenJoinExpression are created simultaneously and kept in sync. |
| public void | addChildTableJoinExpressionToAllParents(DatabaseTable table, Expression expression)
INTERNAL: call addChildTableJoinExpression on all parents |
| public void | addClassIndicator(Class<?> childClass, Object typeValue)
PUBLIC: Add a class indicator for the root classes subclass. |
| public void | addClassIndicatorFieldToInsertRow(AbstractRecord databaseRow)
INTERNAL: Add abstract class indicator information to the database row. |
| public void | addClassIndicatorFieldToRow(AbstractRecord databaseRow)
Implements abstract org. |
| protected void | |
| public void | addClassNameIndicator(String childClassName, Object typeValue)
Implements abstract org. |
| protected void | |
| public void | appendWithAllSubclassesExpression(SQLSelectStatement selectStatement)
INTERNAL: Append the branch with all subclasses expression to the statement. |
| public SQLSelectStatement | buildClassIndicatorSelectStatement(ObjectLevelReadQuery query)
INTERNAL: Return a select statement that will be used to query the class indicators required to query. |
| public SQLSelectStatement | buildViewSelectStatement(ObjectLevelReadQuery query)
INTERNAL: Build a select statement for all subclasses on the view using the same selection criteria as the query. |
| public Class | classFromRow(AbstractRecord rowFromDatabase, AbstractSession session)
Implements abstract org. |
| public Class | classFromValue(Object classFieldValue, AbstractSession session)
INTERNAL: This method is used to turn the a raw database field value classFieldValue into a Class object. |
| public Object | |
| public void | convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings. |
| protected <T> Class | convertClassNameToClass(String className, ClassLoader classLoader)
INTERNAL: Convert the given className to an actual class. |
| public void | dontReadSubclassesOnQueries()
PUBLIC: Set the descriptor to only read instance of itself when queried. |
| public void | dontUseClassNameAsIndicator()
PUBLIC: Set the descriptor not to use the class' full name as the indicator. |
| protected List | getAllChildClassIndicators()
INTERNAL: Stores class indicators for all child and children's children. |
| public List | getAllChildDescriptors()
Implements abstract org. |
| protected List | getAllChildDescriptors(List<ClassDescriptor> allChildDescriptors)
INTERNAL: Recursive subroutine of getAllChildDescriptors. |
| public Vector | |
| public List | |
| public Expression | getChildrenJoinExpression()
INTERNAL: all expressions from childrenTablesJoinExpressions ANDed together |
| public List | getChildrenTables()
INTERNAL: if reads subclasses, all tables for all read subclasses (indirect included). |
| public Map | getChildrenTablesJoinExpressions()
INTERNAL: join expression for each child table, keyed by the table |
| protected Method | |
| public String | getClassExtractionMethodName()
ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. |
| public ClassExtractor | getClassExtractor()
ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism. |
| public Vector | |
| public DatabaseField | getClassIndicatorField()
Implements abstract org. |
| public String | getClassIndicatorFieldName()
Implements abstract org. |
| public Map | getClassIndicatorMapping()
Implements abstract org. |
| protected Object | |
| 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. |
| public Map | getClassNameIndicatorMapping()
Implements abstract org. |
| 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 |
| public ClassDescriptor | getDescriptor()
Implements abstract org. |
| public ClassDescriptor | getDescriptor(Class<?> theClass)
INTERNAL: Returns descriptor corresponding to the class owning the policy or its subclass - otherwise null. |
| public Expression | |
| public Class | getParentClass()
Implements abstract org. |
| public String | |
| public ClassDescriptor | getParentDescriptor()
Implements abstract org. |
| public DatabaseTable | getReadAllSubclassesView()
INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. |
| public String | getReadAllSubclassesViewName()
ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. |
| public ClassDescriptor | |
| public ClassDescriptor | |
| 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. |
| public Expression | |
| public boolean | |
| public boolean | hasClassExtractor()
Implements abstract org. |
| public boolean | |
| public boolean | hasMultipleTableChild()
INTERNAL: Return if any children of this descriptor require information from another table not specified at the parent level. |
| public boolean | |
| public void | initialize(AbstractSession session)
INTERNAL: Initialize the inheritance properties of the descriptor once the mappings are initialized. |
| protected void | |
| protected void | initializeClassExtractor(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 | |
| protected void | initializeWithAllSubclassesExpression()
INTERNAL: Initialize the expression to use for queries to the class and its subclasses. |
| public boolean | |
| public boolean | Returns: isJoinedStrategy valueINTERNAL: Indicate whether a single table or joined inheritance strategy is being used. |
| public boolean | isRootParentDescriptor()
Implements abstract org. |
| public void | postInitialize(AbstractSession session)
INTERNAL: Initialized the inheritance properties that cannot be initialized until after the mappings have been. |
| public void | preInitialize(AbstractSession session)
INTERNAL: Allow the inheritance properties of the descriptor to be initialized. |
| public void | readSubclassesOnQueries()
PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried. |
| public void | |
| protected void | removeChildren(ClassDescriptor descriptor, Set<Class<?>> classes, Set<Class<?>> subclasses)
Remove all of the subclasses (and so on) from the set of classes. |
| public boolean | requiresMultipleTableSubclassRead()
INTERNAL: Return if this descriptor has children that define additional tables and needs to read them. |
| protected Vector | Returns: vector containing database rows.INTERNAL: Select all rows from a abstract table descriptor. |
| protected Vector | Returns: vector containing database rows.INTERNAL: Select all rows from a abstract table descriptor. |
| public Vector | Returns: vector containing database rows.INTERNAL: Select all rows from a abstract table descriptor. |
| protected AbstractRecord | selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query)
INTERNAL: Select one rows from a abstract table descriptor. |
| protected AbstractRecord | selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query)
INTERNAL: Select one row of any concrete subclass, This must use two selects, the first retrieves the type field only. |
| public 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 | |
| public void | setAlwaysUseOuterJoinForClassType(boolean choice)
PUBLIC: Sets the inheritance policy to always use an outer join when querying across a relationship of class. |
| public void | |
| public void | setClassExtractionMethodName(String staticClassClassExtractionMethod)
ADVANCED: A class extraction method can be registered with the descriptor to override the default inheritance mechanism. |
| public void | setClassExtractor(ClassExtractor classExtractor)
ADVANCED: A class extractor can be registered with the descriptor to override the default inheritance mechanism. |
| public void | setClassExtractorName(String classExtractorName)
Implements abstract org. |
| public void | setClassIndicatorAssociations(Vector<E> classIndicatorAssociations)
INTERNAL: Set the class indicator associations from reading the deployment XML. |
| public void | setClassIndicatorField(DatabaseField classIndicatorField)
Implements abstract org. |
| public void | |
| public void | setClassIndicatorMapping(Map<K, V> classIndicatorMapping)
Implements abstract org. |
| public void | setClassNameIndicatorMapping(Map<K, V> classNameIndicatorMapping)
INTERNAL: Set the class name indicator mapping, used by the MW. |
| 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 |
| public void | setDescriptor(ClassDescriptor descriptor)
Implements abstract org. |
| public void | |
| public void | setOnlyInstancesExpression(Expression onlyInstancesExpression)
ADVANCED: Sets the expression used to select instance of the class only. |
| public void | |
| public void | setParentClassName(String parentClassName)
Implements abstract org. |
| public void | |
| protected void | setReadAllSubclassesView(DatabaseTable readAllSubclassesView)
INTERNAL: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. |
| public void | setReadAllSubclassesViewName(String readAllSubclassesViewName)
ADVANCED: The view can be used to optimize/customize the query for all subclasses where they have multiple tables. |
| public void | setShouldOuterJoinSubclasses(boolean shouldOuterJoinSubclasses)
PUBLIC: Set if an outer join should be used to read subclasses. |
| public void | setShouldReadSubclasses(Boolean shouldReadSubclasses)
Implements abstract org. |
| public void | setShouldReadSubclasses(boolean shouldReadSubclasses)
PUBLIC: Set the descriptor to read instance of itself and its subclasses when queried. |
| public void | setShouldUseClassNameAsIndicator(boolean shouldUseClassNameAsIndicator)
PUBLIC: Set if the descriptor uses the classes fully qualified name as the indicator. |
| public void | |
| 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. |
| public void | setWithAllSubclassesExpression(Expression withAllSubclassesExpression)
ADVANCED: Sets the expression to be used for querying for a class and all its subclasses. |
| public boolean | shouldAlwaysUseOuterJoin()
PUBLIC: returns if the inheritance policy will always use an outerjoin when selecting class type |
| public boolean | |
| public boolean | shouldReadSubclasses()
PUBLIC: Return true if this descriptor should read instances of itself and subclasses on queries. |
| public Boolean | shouldReadSubclassesValue()
INTERNAL: Return true if this descriptor should read instances of itself and subclasses on queries. |
| public boolean | shouldUseClassNameAsIndicator()
PUBLIC: Return true if the descriptor use the classes full name as the indicator. |
| public String | |
| protected void | updateTables()
INTERNAL: set the tables on the child descriptor overridden in org.eclipse.persistence.internal.oxm.QNameInheritancePolicy |
| public void |