Class JpaAdapter
java.lang.Object
org.springframework.data.jpa.util.JpaAdapter
Creates
queries from an EntityManager in a way that stays binary-compatible across Jakarta
Persistence API generations.
Jakarta Persistence 4 changes the return type of the untyped query factory methods, so code compiled against 3.2
fails with a NoSuchMethodError when running against 4 and therefore we're falling back tom reflection.
- Since:
- 4.2
- Author:
- Oscar Fanchin, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionstatic QuerycreateNamedQuery(EntityManager entityManager, String queryName) Create an untyped named query using the runtime Jakarta Persistence API.static QuerycreateNativeQuery(EntityManager entityManager, String queryString) Create an untyped native query using the runtime Jakarta Persistence API.static QuerycreateNativeQuery(EntityManager entityManager, String queryString, Class<?> resultClass) Create a native query for the given result type using the runtime Jakarta Persistence API.static QuerycreateNativeQuery(EntityManager entityManager, String queryString, String resultSetMapping) Create a native query for the given SQL result set mapping using the runtime Jakarta Persistence API.static QuerycreateQuery(EntityManager entityManager, CriteriaDelete<?> criteriaDelete) Create a delete query using the runtime Jakarta Persistence API.static <T> TypedQuery<T> createQuery(EntityManager entityManager, CriteriaQuery<T> criteriaQuery) Create a typed query through theCriteriaSelectoverload common to Jakarta Persistence API generations.static QuerycreateQuery(EntityManager entityManager, CriteriaUpdate<?> criteriaUpdate) Create an update query using the runtime Jakarta Persistence API.static QuerycreateQuery(EntityManager entityManager, String queryString) Create an untyped query using the runtime Jakarta Persistence API.static List<ReflectiveMethod>
-
Method Details
-
getReflectiveMethods
-
createQuery
Create an untyped query using the runtime Jakarta Persistence API. -
createNamedQuery
Create an untyped named query using the runtime Jakarta Persistence API. -
createNativeQuery
Create an untyped native query using the runtime Jakarta Persistence API. -
createNativeQuery
public static Query createNativeQuery(EntityManager entityManager, String queryString, Class<?> resultClass) Create a native query for the given result type using the runtime Jakarta Persistence API. -
createNativeQuery
public static Query createNativeQuery(EntityManager entityManager, String queryString, String resultSetMapping) Create a native query for the given SQL result set mapping using the runtime Jakarta Persistence API. -
createQuery
public static <T> TypedQuery<T> createQuery(EntityManager entityManager, CriteriaQuery<T> criteriaQuery) Create a typed query through theCriteriaSelectoverload common to Jakarta Persistence API generations. -
createQuery
Create an update query using the runtime Jakarta Persistence API. -
createQuery
Create a delete query using the runtime Jakarta Persistence API.
-