Closed aistomin closed 4 months ago
Fixed. In order to achieve the desired behaviour, I had to explicitly tell Hibernate how to fetch the dependent collections: I used @Query
annotations for getters.
Actually, it was not necessary. The problem was not the code itself, but the test. You obviously need a session to load those entities lazily. When I marked test as @Transactional
everything works without any additional modifications of the source code, I just had to remove this fetch = FetchType.EAGER
configuration.
Get rid of
FetchType.EAGER
in the code like following: