diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchEntityWithDisabledProxyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchEntityWithDisabledProxyTest.java index b1df48aeff..e2a6f0bd71 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchEntityWithDisabledProxyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchEntityWithDisabledProxyTest.java @@ -56,9 +56,11 @@ public class BatchEntityWithDisabledProxyTest { cheese1.setBestCheese( cheese1 ); cheese2.setBestCheese( cheese1 ); + cheese3.setBestCheese( cheese1 ); cheese1.setReplacement( cheese2 ); cheese2.setReplacement( cheese1 ); + cheese3.setReplacement( cheese1 ); scope.inTransaction( s -> { s.persist( cheese1 ); @@ -95,6 +97,17 @@ public class BatchEntityWithDisabledProxyTest { } ); } + @Test + @JiraKey("HHH-16966") + public void testGetReference(SessionFactoryScope scope) { + scope.inSession( s -> { + s.getSessionFactory().getCache().evictAllRegions(); + + Product product = s.getReference( Product.class, 3 ); + assertTrue( Hibernate.isInitialized(product) ); + } ); + } + @Entity(name = "Order") @Table(name = "ORDER_TABLE") public static class Order {