1

I'd like to get the sql string from a CriteriaQuery using Hibernate 6.

Any ideas?

BetaRide
  • 16,207
  • 29
  • 99
  • 177
  • Have you checked the [`SQLExtractor`](https://github.com/vladmihalcea/hypersistence-utils/blob/20e64bb04257364db3446148d7ad6fe8739579a6/hypersistence-utils-hibernate-62/src/main/java/io/hypersistence/utils/hibernate/query/SQLExtractor.java) from [this article](https://vladmihalcea.com/get-sql-from-jpql-or-criteria/)? It has a hibernate 6 as well as 6.2 version. – XtremeBaumer May 23 '23 at 12:19
  • Yes. `SQLExtractor` uses reflection to call `Query.getQueryString()` which does not work for CriteriaQuery in hibernate 6. Added `SQLExtractor` to the negative list. – BetaRide May 24 '23 at 04:22
  • Hello @BetaRide, could you please share the solution if you managed to find it? – Egor Aug 04 '23 at 15:18
  • 1
    Nothing to share so far :-(. – BetaRide Aug 07 '23 at 05:42

0 Answers0