JPA Criteria do not load eagerly JOIN Fecth collections as Hibernate Criteria did

This commit is contained in:
Andrea Boriero 2021-04-06 17:56:30 +02:00
parent dc21d565d3
commit 951a7611b3
1 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase {
s -> { s -> {
s.beginTransaction(); s.beginTransaction();
try { try {
Contract c = getContract( s ); Contract c = s.load(Contract.class, contract.getId());
// Contract c = (Contract) s.createCriteria(Contract.class).uniqueResult(); // Contract c = (Contract) s.createCriteria(Contract.class).uniqueResult();
assertTrue( s.isReadOnly( c ) ); assertTrue( s.isReadOnly( c ) );
assertEquals( c.getCustomerName(), "gavin" ); assertEquals( c.getCustomerName(), "gavin" );
@ -153,7 +153,7 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase {
inSession( inSession(
s -> { s -> {
Contract c = getContract( s ); Contract c = s.load( Contract.class, contract.getId() );
assertTrue( s.isReadOnly( c ) ); assertTrue( s.isReadOnly( c ) );
assertEquals( c.getCustomerName(), "gavin" ); assertEquals( c.getCustomerName(), "gavin" );
assertEquals( c.getVariations().size(), 2 ); assertEquals( c.getVariations().size(), 2 );
@ -1218,7 +1218,7 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase {
inTransaction( inTransaction(
s -> { s -> {
Contract c = getContract( s ); Contract c = s.load( Contract.class, contract.getId() );
assertEquals( c.getCustomerName(), "gavin" ); assertEquals( c.getCustomerName(), "gavin" );
assertEquals( c.getVariations().size(), 2 ); assertEquals( c.getVariations().size(), 2 );
Iterator it = c.getVariations().iterator(); Iterator it = c.getVariations().iterator();