Enum Class PersistenceProvider

java.lang.Object
java.lang.Enum<PersistenceProvider>
org.springframework.data.jpa.provider.PersistenceProvider
All Implemented Interfaces:
Serializable, Comparable<PersistenceProvider>, Constable, ProxyIdAccessor, QueryExtractor

public enum PersistenceProvider extends Enum<PersistenceProvider> implements QueryExtractor, ProxyIdAccessor
Enumeration representing persistence providers to be used.
Author:
Oliver Gierke, Thomas Darimont, Mark Paluch, Jens Schauder
  • Enum Constant Details

    • HIBERNATE

      public static final PersistenceProvider HIBERNATE
      Hibernate persistence provider.

      Since Hibernate 4.3 the location of the HibernateEntityManager moved to the org.hibernate.jpa package. In order to support both locations we interpret both classnames as a Hibernate PersistenceProvider.

      See Also:
    • GENERIC_JPA

      public static final PersistenceProvider GENERIC_JPA
      Unknown special provider. Use standard JPA.
  • Method Details

    • values

      public static PersistenceProvider[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PersistenceProvider valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromEntityManager

      public static PersistenceProvider fromEntityManager(jakarta.persistence.EntityManager em)
      Determines the PersistenceProvider from the given EntityManager. If no special one can be determined GENERIC_JPA will be returned.
      Parameters:
      em - must not be null.
      Returns:
      will never be null.
    • fromMetamodel

      public static PersistenceProvider fromMetamodel(jakarta.persistence.metamodel.Metamodel metamodel)
      Determines the PersistenceProvider from the given Metamodel. If no special one can be determined GENERIC_JPA will be returned.
      Parameters:
      metamodel - must not be null.
      Returns:
      will never be null.
    • getCountQueryPlaceholder

      public String getCountQueryPlaceholder()
      Returns the placeholder to be used for simple count queries. Default implementation returns x.
      Returns:
      a placeholder for count queries. Guaranteed to be not null.
    • canExtractQuery

      public boolean canExtractQuery()
      Description copied from interface: QueryExtractor
      Returns whether the extractor is able to extract the original query string from a given Query.
      Specified by:
      canExtractQuery in interface QueryExtractor
      Returns:
    • getIdClassAttributes

      public <T> Set<jakarta.persistence.metamodel.SingularAttribute<? super T,?>> getIdClassAttributes(jakarta.persistence.metamodel.IdentifiableType<T> type)
      Parameters:
      type - the entity type.
      Returns:
      the set of identifier attributes used in a @IdClass for type. Empty when type does not use @IdClass.
      Since:
      2.5.6
    • executeQueryWithResultStream

      public CloseableIterator<Object> executeQueryWithResultStream(jakarta.persistence.Query jpaQuery)