Cache JPA Native Query
Asked Answered
D

0

1

PROBLEM: Need to cache a native query (Hibernate Query Caching) in a stateless DAO EJB. Hibernate 5.3, Jpa 2.1, JavaEE 7.

RESEARCH:

Working example:

getEntityManager().createNativeQuery("SELECT MIN(start_date) FROM report")
  .getSingleResult();

Exception example:

getEntityManager().createNativeQuery("SELECT MIN(start_date) FROM report")
  .setHint(QueryHints.HINT_CACHEABLE, true)
  .getSingleResult(); // IlligalStateException "aliases expected length is 0; actual length is 1".

QUESTION: How to cache a native SQL request?

Demimondaine answered 21/2, 2019 at 7:49 Comment(1)
try a solution / workaround described here #25789676Depalma

© 2022 - 2024 — McMap. All rights reserved.