File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/provider Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,23 @@ public static String getHibernateQuery(Object query) {
45
45
try {
46
46
47
47
// Try the new Hibernate implementation first
48
- if (query instanceof SqmQuery ) {
49
- return ((SqmQuery ) query ).getSqmStatement ().toHqlString ();
48
+ if (query instanceof SqmQuery sqmQuery ) {
49
+
50
+ String hql = sqmQuery .getQueryString ();
51
+
52
+ if (!hql .equals ("<criteria>" )) {
53
+ return hql ;
54
+ }
55
+
56
+ return sqmQuery .getSqmStatement ().toHqlString ();
50
57
}
51
58
52
59
// Couple of cases in which this still breaks, see HHH-15389
53
60
} catch (RuntimeException o_O ) {}
54
61
55
62
// Try the old way, as it still works in some cases (haven't investigated in which exactly)
56
-
57
- if (query instanceof Query ) {
58
- return ((Query <?>) query ).getQueryString ();
63
+ if (query instanceof Query <?> hibernateQuery ) {
64
+ return hibernateQuery .getQueryString ();
59
65
} else {
60
66
throw new IllegalArgumentException ("Don't know how to extract the query string from " + query );
61
67
}
You can’t perform that action at this time.
0 commit comments