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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionEclipseLink persistence provider.Unknown special provider.Hibernate persistence provider. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the extractor is able to extract the original query string from a givenQuery
.static Object
Because Hibernate's TypedParameterValue is only used to wrap a null, swap it out with an empty string for query creation.executeQueryWithResultStream
(jakarta.persistence.Query jpaQuery) static PersistenceProvider
fromEntityManager
(jakarta.persistence.EntityManager em) Determines thePersistenceProvider
from the givenEntityManager
.static PersistenceProvider
fromMetamodel
(jakarta.persistence.metamodel.Metamodel metamodel) Determines thePersistenceProvider
from 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) getParameterAccessor
(JpaParameters parameters, Object[] values, jakarta.persistence.EntityManager em) static PersistenceProvider
Returns 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, valueOf
Methods inherited from interface org.springframework.data.jpa.provider.ProxyIdAccessor
getIdentifierFrom, shouldUseAccessorFor
Methods inherited from interface org.springframework.data.jpa.provider.QueryComment
getCommentHintKey, getCommentHintValue
Methods inherited from interface org.springframework.data.jpa.provider.QueryExtractor
extractQueryString
-
Enum Constant Details
-
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:
-
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 thePersistenceProvider
from the givenEntityManager
. If no special one can be determinedGENERIC_JPA
will be returned.- Parameters:
em
- must not be null.- Returns:
- will never be null.
-
fromMetamodel
Determines thePersistenceProvider
from the givenMetamodel
. If no special one can be determinedGENERIC_JPA
will be returned.- Parameters:
metamodel
- must not be null.- Returns:
- will never be null.
-
getParameterAccessor
public JpaParametersParameterAccessor getParameterAccessor(JpaParameters parameters, Object[] values, jakarta.persistence.EntityManager em) -
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:QueryExtractor
Returns whether the extractor is able to extract the original query string from a givenQuery
.- Specified by:
canExtractQuery
in 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
@IdClass
fortype
. Empty whentype
does not use@IdClass
. - Since:
- 2.5.6
-
condense
Because Hibernate's TypedParameterValue is only used to wrap a null, swap it out with an empty string for query creation.- Parameters:
value
-- Returns:
- the original value or an empty string.
- Since:
- 3.0
-
executeQueryWithResultStream
-