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