Class JpaMetamodelMappingContext

java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
org.springframework.data.jpa.mapping.JpaMetamodelMappingContext
All Implemented Interfaces:
Aware, InitializingBean, ApplicationContextAware, ApplicationEventPublisherAware, org.springframework.data.mapping.context.MappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>

public class JpaMetamodelMappingContext extends org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
MappingContext implementation based on a Jpa Metamodel.
Since:
1.3
Author:
Oliver Gierke, Christoph Strobl, Mark Paluch, David Madden
  • Constructor Summary

    Constructors
    Constructor
    Description
    JpaMetamodelMappingContext(Set<jakarta.persistence.metamodel.Metamodel> models)
    Creates a new JPA Metamodel based MappingContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <T> org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>
    createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
     
    createPersistentProperty(org.springframework.data.mapping.model.Property property, org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
     
    <T> org.springframework.data.mapping.PersistentPropertyPaths<T,JpaPersistentProperty>
    We customize the lookup of PersistentPropertyPaths by also traversing properties that are embeddables.
    boolean
     
    protected boolean
    shouldCreatePersistentEntityFor(org.springframework.data.util.TypeInformation<?> type)
     

    Methods inherited from class org.springframework.data.mapping.context.AbstractMappingContext

    addPersistentEntity, addPersistentEntity, afterPropertiesSet, doFindPersistentPropertyPaths, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, initialize, setApplicationContext, setApplicationEventPublisher, setInitialEntitySet, setManagedTypes, setSimpleTypeHolder, setStrict

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.data.mapping.context.MappingContext

    getRequiredPersistentEntity, getRequiredPersistentEntity, getRequiredPersistentEntity
  • Constructor Details

    • JpaMetamodelMappingContext

      public JpaMetamodelMappingContext(Set<jakarta.persistence.metamodel.Metamodel> models)
      Creates a new JPA Metamodel based MappingContext.
      Parameters:
      models - must not be null or empty.
  • Method Details

    • createPersistentEntity

      protected <T> org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?> createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
      Specified by:
      createPersistentEntity in class org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
    • createPersistentProperty

      protected JpaPersistentProperty createPersistentProperty(org.springframework.data.mapping.model.Property property, org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
      Specified by:
      createPersistentProperty in class org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
    • shouldCreatePersistentEntityFor

      protected boolean shouldCreatePersistentEntityFor(org.springframework.data.util.TypeInformation<?> type)
      Overrides:
      shouldCreatePersistentEntityFor in class org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
    • findPersistentPropertyPaths

      public <T> org.springframework.data.mapping.PersistentPropertyPaths<T,JpaPersistentProperty> findPersistentPropertyPaths(Class<T> type, Predicate<? super JpaPersistentProperty> predicate)
      We customize the lookup of PersistentPropertyPaths by also traversing properties that are embeddables.
      Specified by:
      findPersistentPropertyPaths in interface org.springframework.data.mapping.context.MappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
      Overrides:
      findPersistentPropertyPaths in class org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
      See Also:
      • AbstractMappingContext.findPersistentPropertyPaths(java.lang.Class, java.util.function.Predicate)
    • hasPersistentEntityFor

      public boolean hasPersistentEntityFor(Class<?> type)
      Specified by:
      hasPersistentEntityFor in interface org.springframework.data.mapping.context.MappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>
      Overrides:
      hasPersistentEntityFor in class org.springframework.data.mapping.context.AbstractMappingContext<org.springframework.data.jpa.mapping.JpaPersistentEntityImpl<?>,JpaPersistentProperty>