From 75885b9dd1cf829e3d8c1eb859969ac43ee596a1 Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Fri, 18 Oct 2024 21:23:33 +0200 Subject: [PATCH] HHH-18739 - Fix for hints in queries containing joins Signed-off-by: Jan Schatteman --- .../java/org/hibernate/dialect/hint/IndexQueryHintHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java index 9a70d55678..ae4134de5e 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/hint/IndexQueryHintHandler.java @@ -25,8 +25,7 @@ public class IndexQueryHintHandler implements QueryHintHandler { public static final IndexQueryHintHandler INSTANCE = new IndexQueryHintHandler(); - private static final Pattern QUERY_PATTERN = Pattern.compile( "^\\s*(select\\b.+?\\bfrom\\b.+?)(\\bwhere\\b.+?)$" ); - + private static final Pattern QUERY_PATTERN = Pattern.compile( "^\\s*(select\\b.+?\\bfrom\\b.+?)(\\b(where|join)\\b.+?)$" ); @Override public String addQueryHints(String query, String hints) { Matcher matcher = QUERY_PATTERN.matcher( query );