Enum Class PersistenceProvider
- All Implemented Interfaces:
Serializable,Comparable<PersistenceProvider>,Constable,ProxyIdAccessor,QueryComment,QueryExtractor
public enum PersistenceProvider
extends Enum<PersistenceProvider>
implements QueryExtractor, ProxyIdAccessor, QueryComment
Enumeration representing persistence providers to be used.
- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Jens Schauder, Greg Turnquist, Yuriy Tsarkov, Ariel Morelli Andres
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionEclipseLink persistence provider.Unknown special provider.Hibernate persistence provider. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the extractor is able to extract the original query string from a givenQuery.executeQueryWithResultStream(jakarta.persistence.Query jpaQuery) static PersistenceProviderfromEntityManager(jakarta.persistence.EntityManager em) Determines thePersistenceProviderfrom the givenEntityManagerby introspectingEntityManagerFactoryviaEntityManager.getEntityManagerFactory().static PersistenceProviderfromEntityManagerFactory(jakarta.persistence.EntityManagerFactory emf) Determines thePersistenceProviderfrom the givenEntityManagerFactory.static PersistenceProviderfromMetamodel(jakarta.persistence.metamodel.Metamodel metamodel) Determines thePersistenceProviderfrom the givenMetamodel.Returns the placeholder to be used for simple count queries.<T> Set<jakarta.persistence.metamodel.SingularAttribute<? super T,?>> getIdClassAttributes(jakarta.persistence.metamodel.IdentifiableType<T> type) booleanstatic ObjectunwrapTypedParameterValue(Object value) Because Hibernate's TypedParameterValue is only used to wrap a null, swap it out withnullfor query creation.static PersistenceProviderReturns the enum constant of this class with the specified name.static PersistenceProvider[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.springframework.data.jpa.provider.ProxyIdAccessor
getIdentifierFrom, shouldUseAccessorForMethods inherited from interface org.springframework.data.jpa.provider.QueryComment
getCommentHintKey, getCommentHintValueMethods inherited from interface org.springframework.data.jpa.provider.QueryExtractor
extractQueryString
-
Enum Constant Details
-
HIBERNATE
Hibernate persistence provider. -
ECLIPSELINK
EclipseLink persistence provider. -
GENERIC_JPA
Unknown special provider. Use standard JPA.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
fromEntityManager
Determines thePersistenceProviderfrom the givenEntityManagerby introspectingEntityManagerFactoryviaEntityManager.getEntityManagerFactory(). If no special one can be determinedGENERIC_JPAwill be returned.This method avoids
EntityManagerinitialization when usingSharedEntityManagerCreatorby accessingEntityManager.getEntityManagerFactory().- Parameters:
em- must not be null.- Returns:
- will never be null.
- See Also:
-
fromEntityManagerFactory
public static PersistenceProvider fromEntityManagerFactory(jakarta.persistence.EntityManagerFactory emf) Determines thePersistenceProviderfrom the givenEntityManagerFactory. If no special one can be determinedGENERIC_JPAwill be returned.- Parameters:
emf- must not be null.- Returns:
- will never be null.
- Since:
- 3.5.1
-
fromMetamodel
Determines thePersistenceProviderfrom the givenMetamodel. If no special one can be determinedGENERIC_JPAwill be returned.- Parameters:
metamodel- must not be null.- Returns:
- will never be null.
-
getCountQueryPlaceholder
Returns the placeholder to be used for simple count queries. Default implementation returnsx.- Returns:
- a placeholder for count queries. Guaranteed to be not
null.
-
canExtractQuery
public boolean canExtractQuery()Description copied from interface:QueryExtractorReturns whether the extractor is able to extract the original query string from a givenQuery.- Specified by:
canExtractQueryin interfaceQueryExtractor- 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
@IdClassfortype. Empty whentypedoes not use@IdClass. - Since:
- 2.5.6
-
unwrapTypedParameterValue
Because Hibernate's TypedParameterValue is only used to wrap a null, swap it out withnullfor query creation.- Parameters:
value-- Returns:
- the original value or null.
- Since:
- 3.0
-
isPresent
public boolean isPresent() -
executeQueryWithResultStream
-