We've run into an unexpected problem upgrading from H2 1.4.199 to version 
2.1.214 .

We're using H2 for unit tests in a Spring Boot/JPA application, currently 
version 2.5.5 .

The unit tests all ran successfully under 1.4.199, the code seems to 
execute correctly against our production Oracle instance, and if I use 
Derby for the Unit Tests they also execute successfully.

As far as I can tell the issue might be around our Parent entity, Person, 
which has quite a large number of child entities. In general the child 
entities are configured for Lazy loading like:

 @OneToMany(fetch = FetchType.LAZY, mappedBy = "person", cascade = 
{CascadeType.ALL}, orphanRemoval = true)

One of the unit tests that's failing is failing because the child entities 
are not returned. What's very perplexing is that if I change the FetchType 
to EAGER, _and_ I pre-fetch the child rows with a separate db call the unit 
test then passes.

// the call below pre-fetches the child data

Surname sn = 
surnameRepoForTest.findSurnameByPerson_Uuid(Integer.valueOf("222222222")).orElse(null);

// the rest of the unit test fails without the pre-fetch AND the EAGER 
fetchtype in Person

Person p = personSearch.getMatchingPersonRecordByEmplid("9546", null, "U", 
DateGetter.getDate("2012-01-01"), "Emp-last", "Emp-phone", null);

assertEquals("222222222", p.getUuid().toString());

Any suggestions on what to try to get this working in H2 2.1.214 with the 
LAZY fetch type and without the pre-fetch of the child data?

Thanks,

Kris

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/8bb4f0f1-ffd7-4142-a589-1083daf577c8n%40googlegroups.com.

Reply via email to