Reputation: 11
I am attempting to use Pageable and org.springframework.data.domain.Page to get a list of entities. We only want one page at a time to be retrieved.
The problem arises when I attempt to access the returned list. When it is within a transaction, when you access the 2nd entity (yes, not the first), it seems to attempt to fetch everything.
If I access the list outside of the transaction, it does not do this. But since we are lazily loading properties, when we attempt to access the lazily loaded properties it throws an error because it is outside of the transaction.
How can I achieve only fetching the specific page we request and being able to access the lazy loaded properties?
Thanks in advance for the help.
Upvotes: 0
Views: 1020
Reputation: 11
This seems to be a hibernate issue with using entity graphs: https://github.com/Cosium/spring-data-jpa-entity-graph/issues/29
Upvotes: 1