Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 Pageable 和 org.springframework.data.domain.Page 来获取实体列表。我们只希望一次检索一页。
当我尝试访问返回的列表时出现问题。当它在事务中时,当您访问第二个实体(是的,不是第一个)时,它似乎试图获取所有内容。
如果我在事务之外访问列表,它不会这样做。但是由于我们是延迟加载属性,当我们尝试访问延迟加载的属性时,它会抛出一个错误,因为它在事务之外。
如何仅获取我们请求的特定页面并能够访问延迟加载的属性?
在此先感谢您的帮助。
这似乎是使用实体图的休眠问题: https ://github.com/Cosium/spring-data-jpa-entity-graph/issues/29