diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java index 89472a6359b4..3164a36c963c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java @@ -37,6 +37,8 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar { private static final String ENTITY_MANAGER_FACTORY_CLASS_NAME = "jakarta.persistence.EntityManagerFactory"; + private static final String QUERY_SQM_IMPL_CLASS_NAME = "org.hibernate.query.sqm.internal.QuerySqmImpl"; + @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { if (ClassUtils.isPresent(HIBERNATE_SESSION_FACTORY_CLASS_NAME, classLoader)) { @@ -53,5 +55,11 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) { Collections.emptyList(), ExecutableMode.INVOKE); }); } + try { + Class clazz = ClassUtils.forName(QUERY_SQM_IMPL_CLASS_NAME, classLoader); + hints.proxies().registerJdkProxy(ClassUtils.getAllInterfacesForClass(clazz, classLoader)); + } + catch (ClassNotFoundException ignored) { + } } }