Skip to content

Commit

Permalink
Fetch HQL from Hibernate using a different API.
Browse files Browse the repository at this point in the history
See #3085
  • Loading branch information
gregturn committed Sep 12, 2023
1 parent d250190 commit c040cfa
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,20 @@ public static String getHibernateQuery(Object query) {

// Try the new Hibernate implementation first
if (query instanceof SqmQuery sqmQuery) {

String hql = sqmQuery.getQueryString();

if (!hql.equals("<criteria>")) {
return hql;
}

return sqmQuery.getSqmStatement().toHqlString();
}

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

// Try the old way, as it still works in some cases (haven't investigated in which exactly)

if (query instanceof Query<?> hibernateQuery) {
return hibernateQuery.getQueryString();
} else {
Expand Down

0 comments on commit c040cfa

Please sign in to comment.