Class JpaAdapter

java.lang.Object
org.springframework.data.jpa.util.JpaAdapter

public abstract class JpaAdapter extends Object
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 Details

    • getReflectiveMethods

      public static List<ReflectiveMethod> getReflectiveMethods()
    • createQuery

      public static Query createQuery(EntityManager entityManager, String queryString)
      Create an untyped query using the runtime Jakarta Persistence API.
    • createNamedQuery

      public static Query createNamedQuery(EntityManager entityManager, String queryName)
      Create an untyped named query using the runtime Jakarta Persistence API.
    • createNativeQuery

      public static Query createNativeQuery(EntityManager entityManager, String queryString)
      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 the CriteriaSelect overload common to Jakarta Persistence API generations.
    • createQuery

      public static Query createQuery(EntityManager entityManager, CriteriaUpdate<?> criteriaUpdate)
      Create an update query using the runtime Jakarta Persistence API.
    • createQuery

      public static Query createQuery(EntityManager entityManager, CriteriaDelete<?> criteriaDelete)
      Create a delete query using the runtime Jakarta Persistence API.