Skip to content

Commit c6f9186

Browse files
committed
Fetch HQL from Hibernate using a different API.
See #3085
1 parent b077d64 commit c6f9186

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/HibernateUtils.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,20 @@ public static String getHibernateQuery(Object query) {
4848

4949
// Try the new Hibernate implementation first
5050
if (query instanceof SqmQuery sqmQuery) {
51+
52+
String hql = sqmQuery.getQueryString();
53+
54+
if (!hql.equals("<criteria>")) {
55+
return hql;
56+
}
57+
5158
return sqmQuery.getSqmStatement().toHqlString();
5259
}
5360

5461
// Couple of cases in which this still breaks, see HHH-15389
5562
} catch (RuntimeException o_O) {}
5663

5764
// Try the old way, as it still works in some cases (haven't investigated in which exactly)
58-
5965
if (query instanceof Query<?> hibernateQuery) {
6066
return hibernateQuery.getQueryString();
6167
} else {

0 commit comments

Comments
 (0)