public class EntityAccessor extends MappedSuperclassAccessor
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
  • Constructor Details

  • 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

      public Boolean getCascadeOnDelete()
      INTERNAL: Used for OX mapping.
    • getClassExtractorName

      public String getClassExtractorName()
      INTERNAL: Used for OX mapping.
    • getConverts

      public List<ConvertMetadata> getConverts()
      INTERNAL: Used for OX mapping.
    • getDiscriminatorColumn

      public DiscriminatorColumnMetadata getDiscriminatorColumn()
      INTERNAL: Used for OX mapping.
    • getDiscriminatorValue

      public String getDiscriminatorValue()
      INTERNAL: Used for OX mapping.
    • getEntityName

      public String getEntityName()
      INTERNAL: Used for OX mapping.
    • getIndexes

      public List<IndexMetadata> getIndexes()
      INTERNAL: Used for OX mapping.
    • getInheritance

      public InheritanceMetadata getInheritance()
      INTERNAL: Used for OX mapping.
    • getNamedEntityGraphs

      public List<NamedEntityGraphMetadata> getNamedEntityGraphs()
      INTERNAL: Used for OX mapping.
    • getPrimaryKeyForeignKey

      public PrimaryKeyForeignKeyMetadata getPrimaryKeyForeignKey()
      INTERNAL: Used for OX mapping.
    • getPrimaryKeyJoinColumns

      public List<PrimaryKeyJoinColumnMetadata> getPrimaryKeyJoinColumns()
      INTERNAL: Used for OX mapping.
    • getSecondaryTables

      public List<SecondaryTableMetadata> getSecondaryTables()
      INTERNAL: Used for OX mapping.
    • getTable

      public TableMetadata 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 class MappedSuperclassAccessor
    • isCascadeOnDelete

      public boolean isCascadeOnDelete()
      INTERNAL:
    • isEntityAccessor

      public boolean isEntityAccessor()
      INTERNAL: Return true if this accessor represents an entity class.
      Overrides:
      isEntityAccessor in class ClassAccessor
    • isMappedSuperclass

      public boolean isMappedSuperclass()
      INTERNAL:
      Overrides:
      isMappedSuperclass in class MappedSuperclassAccessor
    • merge

      public void merge(ORMetadata metadata)
      INTERNAL: Entity level merging details.
      Overrides:
      merge in class MappedSuperclassAccessor
    • 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 class MappedSuperclassAccessor
    • 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 class ClassAccessor
    • 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 class MappedSuperclassAccessor
    • 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 class MappedSuperclassAccessor
    • processCaching

      protected void processCaching()
      INTERNAL: Process a caching metadata for this entity accessor logging ignore warnings where necessary.
      Overrides:
      processCaching in class MappedSuperclassAccessor
    • processCascadeOnDelete

      protected void processCascadeOnDelete()
      INTERNAL: Check if CascadeOnDelete was set on the Entity.
    • processClassExtractor

      public String 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

      public void processConvert(ConvertMetadata convert)
      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

      public void processDerivedId(HashSet<ClassAccessor> processing, HashSet<ClassAccessor> processed)
      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 class ClassAccessor
    • processDiscriminatorColumn

      public DatabaseField processDiscriminatorColumn()
      INTERNAL: Process the discriminator column metadata (defaulting if necessary), and return the EclipseLink database field.
    • processDiscriminatorValue

      public String 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

      public void processListeners(ClassLoader loader)
      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 class ClassAccessor
      See Also:
    • processSecondaryTable

      protected void processSecondaryTable(SecondaryTableMetadata secondaryTable)
      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

      protected void processTable(TableMetadata table)
      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

      public void setCascadeOnDelete(Boolean cascadeOnDelete)
      INTERNAL: Used for OX mapping.
    • setClassExtractorName

      public void setClassExtractorName(String classExtractorName)
      INTERNAL: Used for OX mapping.
    • setConverts

      public void setConverts(List<ConvertMetadata> converts)
      INTERNAL: Used for OX mapping.
    • setDiscriminatorColumn

      public void setDiscriminatorColumn(DiscriminatorColumnMetadata discriminatorColumn)
      INTERNAL: Used for OX mapping.
    • setDiscriminatorValue

      public void setDiscriminatorValue(String discriminatorValue)
      INTERNAL: Used for OX mapping.
    • setEntityName

      public void setEntityName(String entityName)
      INTERNAL: Used for OX mapping.
    • setIndexes

      public void setIndexes(List<IndexMetadata> indexes)
      INTERNAL: Used for OX mapping.
    • setInheritance

      public void setInheritance(InheritanceMetadata inheritance)
      INTERNAL: Used for OX mapping.
    • setNamedEntityGraphs

      public void setNamedEntityGraphs(List<NamedEntityGraphMetadata> namedEntityGraphs)
      INTERNAL: Used for OX mapping.
    • setPrimaryKeyForeignKey

      public void setPrimaryKeyForeignKey(PrimaryKeyForeignKeyMetadata primaryKeyForeignKey)
      INTERNAL: Used for OX mapping.
    • setPrimaryKeyJoinColumns

      public void setPrimaryKeyJoinColumns(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns)
      INTERNAL: Used for OX mapping.
    • setSecondaryTables

      public void setSecondaryTables(List<SecondaryTableMetadata> secondaryTables)
      INTERNAL: Used for OX mapping.
    • setTable

      public void setTable(TableMetadata table)
      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.