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 3164a36c96..eb6e204028 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 @@ -39,6 +39,8 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar { private static final String QUERY_SQM_IMPL_CLASS_NAME = "org.hibernate.query.sqm.internal.QuerySqmImpl"; + private static final String NATIVE_QUERY_IMPL_CLASS_NAME = "org.hibernate.query.sql.internal.NativeQueryImpl"; + @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { if (ClassUtils.isPresent(HIBERNATE_SESSION_FACTORY_CLASS_NAME, classLoader)) { @@ -61,5 +63,11 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar { } catch (ClassNotFoundException ignored) { } + try { + Class clazz = ClassUtils.forName(NATIVE_QUERY_IMPL_CLASS_NAME, classLoader); + hints.proxies().registerJdkProxy(ClassUtils.getAllInterfacesForClass(clazz, classLoader)); + } + catch (ClassNotFoundException ignored) { + } } }