Add missing Hibernate reflection hints

This commit adds the missing reflection hints for Hibernate 8 support:
`PersistenceUnitInfoDescriptor` and `StatelessSession`.

Fixes gh-37247
Fixes gh-37249
This commit is contained in:
Brian Clozel
2026-09-07 09:34:38 +02:00
parent 6e260bc78e
commit 486db005a1
2 changed files with 28 additions and 25 deletions
@@ -19,6 +19,8 @@ package org.springframework.orm.jpa;
import jakarta.persistence.EntityManagerFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -55,6 +57,7 @@ class EntityManagerRuntimeHintsTests {
void entityManagerProxyHasHibernateHints() {
assertThat(RuntimeHintsPredicates.proxies().forInterfaces(Session.class, EntityManagerProxy.class))
.accepts(this.hints);
assertThat(RuntimeHintsPredicates.proxies().forInterfaces(StatelessSession.class)).accepts(this.hints);
}
@Test
@@ -63,4 +66,10 @@ class EntityManagerRuntimeHintsTests {
assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(EntityManagerFactory.class, "getMetamodel")).accepts(this.hints);
}
@Test
void persistenceUnitInfoDescriptorHasReflectionHints() {
assertThat(RuntimeHintsPredicates.reflection().onMethodInvocation(PersistenceUnitInfoDescriptor.class, "getName"))
.accepts(this.hints);
}
}