Module org.eclipse.persistence.jpa
Class EntityAccessor
java.lang.Object
org.eclipse.persistence.internal.jpa.metadata.ORMetadata
org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor
An entity accessor.
Key notes:
- any metadata mapped from XML to this class must be compared in the
equals method.
- any metadata mapped from XML to this class must be handled in the merge
method. (merging is done at the accessor/mapping level)
- any metadata mapped from XML to this class must be initialized in the
initXMLObject method.
- methods should be preserved in alphabetical order.
- Since:
- EclipseLink 1.0
-
Field Summary
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
m_project
-
Constructor Summary
ConstructorDescriptionINTERNAL:EntityAccessor
(MetadataAnnotation annotation, MetadataClass cls, MetadataProject project) INTERNAL: -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMultipleTableKeyFields
(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns, DatabaseTable targetTable, String PK_CTX, String FK_CTX) INTERNAL: Add multiple fields to the descriptor.protected void
discoverMappedSuperclassesAndInheritanceParents
(boolean addMappedSuperclassAccessors) INTERNAL: Build a list of classes that are decorated with a MappedSuperclass annotation or that are tagged as a mapped-superclass in an XML document.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.INTERNAL: Used for OX mapping.getTable()
INTERNAL: Used for OX mapping.boolean
INTERNAL: This method is a little involved since a class extractor is mutually exclusive with a discriminator column.boolean
INTERNAL: Return true if this class has an inheritance specifications.void
initXMLObject
(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings) INTERNAL:boolean
INTERNAL:boolean
INTERNAL: Return true if this accessor represents an entity class.boolean
INTERNAL:void
merge
(ORMetadata metadata) INTERNAL: Entity level merging details.void
INTERNAL: The pre-process method is called during regular deployment and metadata processing and will pre-process the items of interest on an entity class.void
INTERNAL: The pre-process for canonical model method is called (and only called) during the canonical model generation.void
process()
INTERNAL: Process the items of interest on an entity class.void
INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes.void
INTERNAL: Figure out the access type for this entity.protected void
INTERNAL: Process a caching metadata for this entity accessor logging ignore warnings where necessary.protected void
INTERNAL: Check if CascadeOnDelete was set on the Entity.INTERNAL: Return the user defined class extractor class for this entity.void
processConvert
(ConvertMetadata convert) INTERNAL: Add a convert metadata to the descriptor convert map.void
INTERNAL: Process the convert metadata for this entity accessor logging ignore warnings where necessary.void
processDerivedId
(HashSet<ClassAccessor> processing, HashSet<ClassAccessor> processed) INTERNAL: Allows for processing DerivedIds.INTERNAL: Process the discriminator column metadata (defaulting if necessary), and return the EclipseLink database field.INTERNAL: Process a discriminator value to set the class indicator on the root descriptor of the inheritance hierarchy.protected void
INTERNAL: Process the entity metadata.protected void
INTERNAL: Process the entity graph metadata on this entity accessor.protected void
INTERNAL: Process index information for the given metadata descriptor.protected void
INTERNAL: Process the Inheritance metadata for a root of an inheritance hierarchy.void
INTERNAL: Process the inheritance metadata for an inheritance subclass.void
processListeners
(ClassLoader loader) INTERNAL: Process the listeners for this entity.void
INTERNAL: Process the accessors for the given class.protected void
processSecondaryTable
(SecondaryTableMetadata secondaryTable) INTERNAL: Process a MetadataSecondaryTable.protected void
INTERNAL: Process secondary-table(s) for a given entity.protected void
INTERNAL: Process table information for the given metadata descriptor.protected void
processTable
(TableMetadata table) INTERNAL: Process a MetadataTable.protected void
INTERNAL: Process any inheritance specifics.void
setCascadeOnDelete
(Boolean cascadeOnDelete) INTERNAL: Used for OX mapping.void
setClassExtractorName
(String classExtractorName) INTERNAL: Used for OX mapping.void
setConverts
(List<ConvertMetadata> converts) INTERNAL: Used for OX mapping.void
setDiscriminatorColumn
(DiscriminatorColumnMetadata discriminatorColumn) INTERNAL: Used for OX mapping.void
setDiscriminatorValue
(String discriminatorValue) INTERNAL: Used for OX mapping.void
setEntityName
(String entityName) INTERNAL: Used for OX mapping.void
setIndexes
(List<IndexMetadata> indexes) INTERNAL: Used for OX mapping.void
setInheritance
(InheritanceMetadata inheritance) INTERNAL: Used for OX mapping.void
setNamedEntityGraphs
(List<NamedEntityGraphMetadata> namedEntityGraphs) INTERNAL: Used for OX mapping.void
setPrimaryKeyForeignKey
(PrimaryKeyForeignKeyMetadata primaryKeyForeignKey) INTERNAL: Used for OX mapping.void
setPrimaryKeyJoinColumns
(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns) INTERNAL: Used for OX mapping.void
setSecondaryTables
(List<SecondaryTableMetadata> secondaryTables) INTERNAL: Used for OX mapping.void
setTable
(TableMetadata table) INTERNAL: Used for OX mapping.protected void
INTERNAL: Validate a OptimisticLocking(type=VERSION_COLUMN) setting.protected void
INTERNAL: Call this method after a primary key should have been found.Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor
excludeDefaultListeners, excludeSuperclassListeners, getAdditionalCriteria, getCache, getCacheable, getCacheIndexes, getCacheInterceptor, getEntityListeners, getExcludeDefaultListeners, getExcludeSuperclassListeners, getExistenceChecking, getFetchGroups, getIdClass, getIdClassName, getMultitenant, getNamedNativeQueries, getNamedPLSQLStoredFunctionQueries, getNamedPLSQLStoredProcedureQueries, getNamedQueries, getNamedStoredFunctionQueries, getNamedStoredProcedureQueries, getOptimisticLocking, getPostLoad, getPostPersist, getPostRemove, getPostUpdate, getPrePersist, getPreRemove, getPreUpdate, getPrimaryKey, getQueryRedirectors, getReadOnly, getSequenceGenerator, getSerializedObjectPolicy, getSqlResultSetMappings, getTableGenerator, getUuidGenerator, hasObjectRelationalFieldMappingAnnotationsDefined, hasObjectRelationalMethodMappingAnnotationsDefined, initIdClass, processAdditionalCriteria, processCache, processCacheable, processCacheIndexes, processCacheInterceptor, processCachingMetadata, processDefaultRedirectors, processEntityListeners, processExcludeDefaultListeners, processExcludeSuperclassListeners, processExistenceChecking, processFetchGroup, processFetchGroups, processIdClass, processMetamodelDescriptor, processMultitenant, processNamedNativeQueries, processNamedPLSQLStoredFunctionQueries, processNamedPLSQLStoredProcedureQueries, processNamedQueries, processNamedStoredFunctionQueries, processNamedStoredProcedureQueries, processOptimisticLocking, processPrimaryKey, processReadOnly, processSequenceGenerator, processSerializedObjectPolicy, processSqlResultSetMappings, processTableGenerator, processUuidGenerator, setAdditionalCriteria, setCache, setCacheable, setCacheIndexes, setCacheInterceptor, setEntityListeners, setExcludeDefaultListeners, setExcludeSuperclassListeners, setExistenceChecking, setFetchGroups, setIdClass, setIdClassName, setMultitenant, setNamedNativeQueries, setNamedPLSQLStoredFunctionQueries, setNamedPLSQLStoredProcedureQueries, setNamedQueries, setNamedStoredFunctionQueries, setNamedStoredProcedureQueries, setOptimisticLocking, setPostLoad, setPostPersist, setPostRemove, setPostUpdate, setPrePersist, setPreRemove, setPreUpdate, setPrimaryKey, setQueryRedirectors, setReadOnly, setSequenceGenerator, setSerializedObjectPolicy, setSqlResultSetMappings, setTableGenerator, setUuidGenerator
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor
addAccessor, addAccessorFields, addAccessorMethods, addAccessors, addPotentialEmbeddableAccessor, addPotentialMappedSuperclass, buildAccessor, clearMappedSuperclassesAndInheritanceParents, clearPreProcessed, equals, excludeDefaultMappings, getAccessibleField, getAccessibleMethod, getAccessibleVirtualMethod, getAccessType, getAnnotation, getAssociationOverrides, getAttributeOverrides, getAttributes, getChangeTracking, getClassName, getCloneCopyPolicy, getCopyPolicy, getCustomCopyPolicy, getCustomizerClass, getCustomizerClassName, getDescription, getExcludeDefaultMappings, getIdentifier, getInstantiationCopyPolicy, getJavaClass, getJavaClassName, getMappedSuperclasses, getMetadataComplete, getNoSql, getOracleArrayTypes, getOracleObjectTypes, getOwningDescriptor, getOwningDescriptors, getParentClass, getParentClassName, getPLSQLRecords, getPLSQLTables, getStruct, hasDerivedId, hashCode, hasParentClass, ignoreAnnotations, initXMLClassAccessor, isAnnotationPresent, isClassAccessor, isEmbeddableAccessor, isMetadataComplete, isPreProcessed, isProcessed, preProcessMappedSuperclassMetadata, processAssociationOverride, processAssociationOverrides, processAttributeOverride, processAttributeOverrides, processChangeTracking, processComplexMetadataTypes, processCopyPolicy, processCustomizer, processMappedSuperclassMetadata, processNoSql, processParentClass, processProperties, processStruct, processVirtualClass, resolveGenericTypes, setAssociationOverrides, setAttributeOverrides, setAttributes, setChangeTracking, setClassName, setCloneCopyPolicy, setCustomCopyPolicy, setCustomizerClassName, setDescription, setExcludeDefaultMappings, setInstantiationCopyPolicy, setIsPreProcessed, setIsProcessed, setJavaClass, setMetadataComplete, setNoSql, setOracleArrayTypes, setOracleObjectTypes, setParentClass, setParentClassName, setPLSQLRecords, setPLSQLTables, setStruct, toString, usesFieldAccess, usesPropertyAccess, usesVirtualAccess
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
getAccess, getAccessibleObject, getAccessMethods, getAnnotatedElement, getAnnotatedElementName, getAnnotation, getAttributeName, getConverters, getDefaultAttributeName, getDescriptor, getDescriptorJavaClass, getHashPartitioning, getName, getObjectTypeConverters, getPartitioned, getPartitioning, getPinnedPartitioning, getProperties, getRangePartitioning, getReferencedField, getReferencedField, getReplicationPartitioning, getRoundRobinPartitioning, getSerializedConverters, getStructConverters, getTypeConverters, getUnionPartitioning, getUpperCaseShortJavaClassName, getValue, getValue, getValuePartitioning, hasAccess, hasAccessMethods, initAccess, initXMLAccessor, isAnnotationPresent, processConverters, processCustomConverters, processObjectTypeConverters, processPartitioned, processPartitioning, processPrimaryKeyJoinColumns, processSerializedConverters, processStructConverters, processTable, processTypeConverters, setAccess, setAccessMethods, setConverters, setDescriptor, setHashPartitioning, setName, setObjectTypeConverters, setPartitioned, setPartitioning, setPinnedPartitioning, setProperties, setRangePartitioning, setReplicationPartitioning, setRoundRobinPartitioning, setSerializedConverters, setStructConverters, setTypeConverters, setUnionPartitioning, setValuePartitioning
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
getAccessibleObjectName, getAnnotation, getBoxedType, getDatabaseTypeEnum, getEntityMappings, getFullyQualifiedClassName, getJavaClass, getJavaClassName, getLoader, getLocation, getLogger, getMetadataClass, getMetadataClass, getMetadataClass, getMetadataFactory, getName, getPrimitiveClassForName, getProject, getText, getXMLElement, hasIdentifier, hasText, initXMLClassName, initXMLObject, initXMLObjects, initXMLTextObject, loadedFromAnnotation, loadedFromEclipseLinkXML, loadedFromXML, mergeORObjectLists, mergeORObjects, mergeSimpleObjects, reloadEntity, reloadMappedSuperclass, setAccessibleObject, setEntityMappings, setFieldName, setFieldName, setProject, shouldOverride, valuesMatch, valuesMatch
-
Constructor Details
-
EntityAccessor
public EntityAccessor()INTERNAL: -
EntityAccessor
INTERNAL:
-
-
Method Details
-
addMultipleTableKeyFields
protected void addMultipleTableKeyFields(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns, DatabaseTable targetTable, String PK_CTX, String FK_CTX) INTERNAL: Add multiple fields to the descriptor. Called from either Inheritance or SecondaryTable context. -
discoverMappedSuperclassesAndInheritanceParents
protected void discoverMappedSuperclassesAndInheritanceParents(boolean addMappedSuperclassAccessors) INTERNAL: Build a list of classes that are decorated with a MappedSuperclass annotation or that are tagged as a mapped-superclass in an XML document. This method will also do a couple other things as well since we are traversing the parent classes: - Build a map of generic types specified and will be used to resolve actual class types for mappings. - Will discover and set the inheritance parent and root descriptors if this entity is part of an inheritance hierarchy. - save mapped-superclass descriptors on the project for later use by the Metamodel API Note: The list is rebuilt every time this method is called since it is called both during pre-deploy and deploy where the class loader dependencies change. -
getCascadeOnDelete
INTERNAL: Used for OX mapping. -
getClassExtractorName
INTERNAL: Used for OX mapping. -
getConverts
INTERNAL: Used for OX mapping. -
getDiscriminatorColumn
INTERNAL: Used for OX mapping. -
getDiscriminatorValue
INTERNAL: Used for OX mapping. -
getEntityName
INTERNAL: Used for OX mapping. -
getIndexes
INTERNAL: Used for OX mapping. -
getInheritance
INTERNAL: Used for OX mapping. -
getNamedEntityGraphs
INTERNAL: Used for OX mapping. -
getPrimaryKeyForeignKey
INTERNAL: Used for OX mapping. -
getPrimaryKeyJoinColumns
INTERNAL: Used for OX mapping. -
getSecondaryTables
INTERNAL: Used for OX mapping. -
getTable
INTERNAL: Used for OX mapping. -
hasClassExtractor
public boolean hasClassExtractor()INTERNAL: This method is a little involved since a class extractor is mutually exclusive with a discriminator column. Within one xml file it is impossible to have both specified since they are within a choice tag. However, if one is specified in the orm.xml and the other in the eclipselink-orm.xml, after the merge both will be set on this accessor, so we need to check which came from the eclipselink-orm.xml because it is the one we need to use. -
hasInheritance
public boolean hasInheritance()INTERNAL: Return true if this class has an inheritance specifications. -
initXMLObject
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings) INTERNAL:- Overrides:
initXMLObject
in classMappedSuperclassAccessor
-
isCascadeOnDelete
public boolean isCascadeOnDelete()INTERNAL: -
isEntityAccessor
public boolean isEntityAccessor()INTERNAL: Return true if this accessor represents an entity class.- Overrides:
isEntityAccessor
in classClassAccessor
-
isMappedSuperclass
public boolean isMappedSuperclass()INTERNAL:- Overrides:
isMappedSuperclass
in classMappedSuperclassAccessor
-
merge
INTERNAL: Entity level merging details.- Overrides:
merge
in classMappedSuperclassAccessor
-
preProcess
public void preProcess()INTERNAL: The pre-process method is called during regular deployment and metadata processing and will pre-process the items of interest on an entity class. The order of processing is important, care must be taken if changes must be made.- Overrides:
preProcess
in classMappedSuperclassAccessor
-
preProcessForCanonicalModel
public void preProcessForCanonicalModel()INTERNAL: The pre-process for canonical model method is called (and only called) during the canonical model generation. The use of this pre-process allows us to remove some items from the regular pre-process that do not apply to the canonical model generation. The order of processing is important, care must be taken if changes must be made.- Overrides:
preProcessForCanonicalModel
in classClassAccessor
-
process
public void process()INTERNAL: Process the items of interest on an entity class. The order of processing is important, care must be taken if changes must be made.- Overrides:
process
in classMappedSuperclassAccessor
-
processAccessMethods
public void processAccessMethods()INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes. -
processAccessType
public void processAccessType()INTERNAL: Figure out the access type for this entity. It works as follows: 1 - check for an explicit access type specification 2 - check our inheritance parents (ignoring explicit specifications) 3 - check our mapped superclasses (ignoring explicit specifications) for the location of annotations 4 - check the entity itself for the location of annotations 5 - check for an xml default from a persistence-unit-metadata-defaults or entity-mappings setting. 6 - we have exhausted our search, default to FIELD.- Overrides:
processAccessType
in classMappedSuperclassAccessor
-
processCaching
protected void processCaching()INTERNAL: Process a caching metadata for this entity accessor logging ignore warnings where necessary.- Overrides:
processCaching
in classMappedSuperclassAccessor
-
processCascadeOnDelete
protected void processCascadeOnDelete()INTERNAL: Check if CascadeOnDelete was set on the Entity. -
processClassExtractor
INTERNAL: Return the user defined class extractor class for this entity. Assumes hasClassExtractor has been called beforehand (meaning we either have an annotation or XML definition. -
processConvert
INTERNAL: Add a convert metadata to the descriptor convert map. -
processConverts
public void processConverts()INTERNAL: Process the convert metadata for this entity accessor logging ignore warnings where necessary. -
processDerivedId
INTERNAL: Allows for processing DerivedIds. All referenced accessors are processed first to ensure the necessary fields are set before this derivedId is processed- Overrides:
processDerivedId
in classClassAccessor
-
processDiscriminatorColumn
INTERNAL: Process the discriminator column metadata (defaulting if necessary), and return the EclipseLink database field. -
processDiscriminatorValue
INTERNAL: Process a discriminator value to set the class indicator on the root descriptor of the inheritance hierarchy. If there is no discriminator value, the class indicator defaults to the class name. -
processEntity
protected void processEntity()INTERNAL: Process the entity metadata. -
processEntityGraphs
protected void processEntityGraphs()INTERNAL: Process the entity graph metadata on this entity accessor. -
processIndexes
protected void processIndexes()INTERNAL: Process index information for the given metadata descriptor. -
processInheritance
protected void processInheritance()INTERNAL: Process the Inheritance metadata for a root of an inheritance hierarchy. One may or may not be specified for the entity class that is the root of the entity class hierarchy, so we need to default in this case. This method should only be called on the root of the inheritance hierarchy. -
processInheritancePrimaryKeyJoinColumns
public void processInheritancePrimaryKeyJoinColumns()INTERNAL: Process the inheritance metadata for an inheritance subclass. The parent descriptor must be provided. -
processListeners
INTERNAL: Process the listeners for this entity. -
processMappingAccessors
public void processMappingAccessors()INTERNAL: Process the accessors for the given class. If we are within a TABLE_PER_CLASS inheritance hierarchy, our parent accessors will already have been added at this point.- Overrides:
processMappingAccessors
in classClassAccessor
- See Also:
-
processSecondaryTable
INTERNAL: Process a MetadataSecondaryTable. Do all the table name defaulting and set the correct, fully qualified name on the TopLink DatabaseTable. -
processSecondaryTables
protected void processSecondaryTables()INTERNAL: Process secondary-table(s) for a given entity. -
processTable
protected void processTable()INTERNAL: Process table information for the given metadata descriptor. -
processTable
INTERNAL: Process a MetadataTable. Do all the table name defaulting and set the correct, fully qualified name on the TopLink DatabaseTable. -
processTableAndInheritance
protected void processTableAndInheritance()INTERNAL: Process any inheritance specifics. NOTE: Inheritance hierarchies are always processed from the top down so it is safe to assume that all our parents have already been processed fully. The only exception being when a root accessor doesn't know they are a root (defaulting case). In this case we'll tell the root accessor to process the inheritance metadata before continuing with our own processing. -
setCascadeOnDelete
INTERNAL: Used for OX mapping. -
setClassExtractorName
INTERNAL: Used for OX mapping. -
setConverts
INTERNAL: Used for OX mapping. -
setDiscriminatorColumn
INTERNAL: Used for OX mapping. -
setDiscriminatorValue
INTERNAL: Used for OX mapping. -
setEntityName
INTERNAL: Used for OX mapping. -
setIndexes
INTERNAL: Used for OX mapping. -
setInheritance
INTERNAL: Used for OX mapping. -
setNamedEntityGraphs
INTERNAL: Used for OX mapping. -
setPrimaryKeyForeignKey
INTERNAL: Used for OX mapping. -
setPrimaryKeyJoinColumns
INTERNAL: Used for OX mapping. -
setSecondaryTables
INTERNAL: Used for OX mapping. -
setTable
INTERNAL: Used for OX mapping. -
validateOptimisticLocking
protected void validateOptimisticLocking()INTERNAL: Validate a OptimisticLocking(type=VERSION_COLUMN) setting. That is, validate that we found a version field. If not, throw an exception. -
validatePrimaryKey
protected void validatePrimaryKey()INTERNAL: Call this method after a primary key should have been found.
-