From 2dc1094b74bddfb189df9831468e4680ee8f0962 Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Mon, 24 Jul 2023 14:08:31 -0500 Subject: [PATCH] Testing --- .../data/jpa/provider/HibernateUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/HibernateUtils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/HibernateUtils.java index ccecfb52a4..3cd9b642d2 100644 --- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/HibernateUtils.java +++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/provider/HibernateUtils.java @@ -48,7 +48,16 @@ public static String getHibernateQuery(Object query) { // Try the new Hibernate implementation first if (query instanceof SqmQuery sqmQuery) { - return sqmQuery.getSqmStatement().toHqlString(); + + String hql = sqmQuery.getQueryString(); + + if (!hql.equals("")) { + return hql; + } + + String sqmHql = sqmQuery.getSqmStatement().toHqlString(); + + return sqmHql; } // Couple of cases in which this still breaks, see HHH-15389