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) {
4545 try {
4646
4747 // 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 ();
5057 }
5158
5259 // Couple of cases in which this still breaks, see HHH-15389
5360 } catch (RuntimeException o_O ) {}
5461
5562 // 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 ();
5965 } else {
6066 throw new IllegalArgumentException ("Don't know how to extract the query string from " + query );
6167 }
You can’t perform that action at this time.
0 commit comments