Seam 会话中的 Hibernate 会话变得太大
我们正在使用 Seam 对话来创建跨多个页面的向导,其中一些屏幕会加载大量数据供用户选择(可以是数千条记录)。 Hibernate 会话保留所有内容,这对于内存使用和性能来说都是一个问题(因为刷新需要几秒钟)。
我们唯一的选择是在加载数据时逐出数据,还是有更好的方法来管理它?
We are using a Seam conversation for a wizard that spans multiple pages, some of these screens load a lot of data for user selection (can be several thousand records). The Hibernate session is holding onto everything, which is an issue for both memory usage and performance (as flush takes several seconds).
Is our only option evicting data as we load it or is there a better way to manage this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的屏幕在会话中保留数千条记录(显然,取决于这些记录有多大),并且长时间保存,那么您肯定会遇到问题。
如何解决问题取决于很多因素。
ETC。
If you have screens that keep several thousand records in the session (depending, obviously, on how big those records are) for an extended period of time, sure, you're going to have problems.
How to solve the problem depends on a lot of factors.
Etc.
您不必保存对话中的所有内容。
只需保留用户插入的数据并使用事件范围进行查询,并在每次访问向导页面时进行查询。
只是不保留查询结果。
You don't have to save everything in a conversation.
Just keep the data inserted by the user and use a Event scope for the queries, and make a query each time you access the page of the wizard.
Just don't keep the results of the query.