Class EclipseLinkJpaMetadataProviderImpl

All Implemented Interfaces:
JpaMetadataProvider, MetadataProvider, Provider

public class EclipseLinkJpaMetadataProviderImpl extends JpaMetadataProviderImpl
Provides an EclipseLink-specific implementation for the JpaMetadataProviderImpl.
  • Constructor Details

    • EclipseLinkJpaMetadataProviderImpl

      public EclipseLinkJpaMetadataProviderImpl()
  • Method Details

    • populateImplementationSpecificEntityLevelMetadata

      protected void populateImplementationSpecificEntityLevelMetadata(DataObjectMetadataImpl metadata, javax.persistence.metamodel.EntityType<?> entityType)
      Hook called after all "standard" annotations are processed to perform any further extraction based on the internals of the JPA implementation.
      Specified by:
      populateImplementationSpecificEntityLevelMetadata in class JpaMetadataProviderImpl
      Parameters:
      metadata - The metadata for the data object.
      entityType - The entity type of the data object.
    • populateImplementationSpecificAttributeLevelMetadata

      protected void populateImplementationSpecificAttributeLevelMetadata(DataObjectAttributeImpl attribute, javax.persistence.metamodel.SingularAttribute<?,?> attr)
      Hook called after all "standard" attribute-level annotations are processed to perform any further extraction based on the internals of the JPA implementation.
      Specified by:
      populateImplementationSpecificAttributeLevelMetadata in class JpaMetadataProviderImpl
      Parameters:
      attribute - The attribute metadata for the data object.
      attr - The persistent single-valued property or field.
    • populateImplementationSpecificCollectionLevelMetadata

      protected void populateImplementationSpecificCollectionLevelMetadata(DataObjectCollectionImpl collection, javax.persistence.metamodel.PluralAttribute<?,?,?> cd)
      Hook called after all "standard" field-level annotations are processed on attributes identified as "plural" to perform any further extraction based on the internals of the JPA implementation.
      Specified by:
      populateImplementationSpecificCollectionLevelMetadata in class JpaMetadataProviderImpl
      Parameters:
      collection - The collection metadata for the data object.
      cd - The persistent collection-valued attribute.
    • getPropertyNameFromDatabaseColumnName

      protected String getPropertyNameFromDatabaseColumnName(javax.persistence.metamodel.ManagedType entityType, String databaseColumnName)
      Returns the property name on the given entity type which the given database column is mapped to.

      If no field on the given type is mapped to this field (which is common in cases of a JPA relationship without an actual Column annotated field to represent the foreign key) then this method will return null.

      Parameters:
      entityType - the entity type on which to search for a property that is mapped to the given column
      databaseColumnName - the name of the database column
      Returns:
      the name of the property on the given entity type which maps to the given column, or null if no such mapping exists
    • populateImplementationSpecificRelationshipLevelMetadata

      protected void populateImplementationSpecificRelationshipLevelMetadata(DataObjectRelationshipImpl relationship, javax.persistence.metamodel.SingularAttribute<?,?> rd)
      Hook called after all "standard" field-level annotations are processed on attributes identified as "associations" to perform any further extraction based on the internals of the JPA implementation.
      Specified by:
      populateImplementationSpecificRelationshipLevelMetadata in class JpaMetadataProviderImpl
      Parameters:
      relationship - The relationship metadata for the data object.
      rd - The persistent single-valued property or field.
    • populateInverseRelationship

      protected void populateInverseRelationship(org.eclipse.persistence.mappings.DatabaseMapping mapping, MetadataChildBase relationship)
      Populates the inverse relationship for a given relationship.
      Parameters:
      mapping - the DatabaseMapping that defines the relationship.
      relationship - the relationship of which to populate the other side.
    • findRelationshipPartner

      protected org.eclipse.persistence.mappings.DatabaseMapping findRelationshipPartner(org.eclipse.persistence.mappings.DatabaseMapping databaseMapping)
      Gets the inverse mapping of the given DatabaseMapping.
      Parameters:
      databaseMapping - the DatabaseMapping of which to get the inverse.
      Returns:
      the inverse mapping of the given DatabaseMapping.
    • addExtensionRelationship

      public DataObjectRelationship addExtensionRelationship(Class<?> entityClass, String extensionPropertyName, Class<?> extensionEntityClass)
      Given the parameters, injects into the JPA repository a 1:1 relationship between the parent entity and the extension entity via the given property name (which must exist on the entityClass).
      Specified by:
      addExtensionRelationship in interface JpaMetadataProvider
      Specified by:
      addExtensionRelationship in class JpaMetadataProviderImpl
      Parameters:
      entityClass - The parent (owning) class which must be already known to the JPA persistence unit. This one's metadata will be modified within the internals of the JPA metadata.
      extensionPropertyName - The property on the parent class which will hold the extensionEntity. This property must be of the type of the extension entity or a superclass. (Object will work.)
      extensionEntityClass - The child/extension class which needs to be linked. It must also already be known to JPA.
      Returns:
      A 1:1 relationship between the parent entry and the extension entity via the given property name.
    • findExtensionInverse

      protected org.eclipse.persistence.mappings.OneToOneMapping findExtensionInverse(org.eclipse.persistence.descriptors.ClassDescriptor extensionEntityDescriptor, Class<?> entityType)
      Gets the inverse extension of the given ClassDescriptor.
      Parameters:
      extensionEntityDescriptor - the ClassDescriptor of which to get the inverse.
      entityType - the type of the entity.
      Returns:
      the inverse extension of the given ClassDescriptor.
    • getClassDescriptor

      protected org.eclipse.persistence.descriptors.ClassDescriptor getClassDescriptor(Class<?> entityClass)
      Gets the descriptor for the entity type.
      Parameters:
      entityClass - the type of the enty.
      Returns:
      the descriptor for the entity type.
    • getEclipseLinkEntityManager

      protected org.eclipse.persistence.jpa.JpaEntityManager getEclipseLinkEntityManager()
      The entity manager for interacting with the database.
      Returns:
      the entity manager for interacting with the database.