JBoss Seam:如何在视图中打开 jpa/hibernate 会话
There is a similar question for Spring.
But what about JBoss Seam, I need a suggestion regarding the application I am developing.
If you need any specific version information, they are
- Seam 2.2
- JSF 1.2
- JPA 1 and Hibernate as persistence provider
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看与持久化上下文相关的Seam 文档。
http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/persistence.html#persistence.seam-management-persistence-contexts
本质上,您使用seam 注册持久化上下文并将EntityManager 注入到您的bean 中。您可以通过在@Begin注释(@Begin和@End控制对话)中设置flushMode将上下文与对话关联起来,以保持会话在多个请求中打开。
Check out the seam documentation related to persistence contexts.
http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/html/persistence.html#persistence.seam-managed-persistence-contexts
Essentially, you register the persistence context with seam and inject the EntityManager into your bean. You can associate the context with a conversation to keep the session open across multiple requests by setting the flushMode in the @Begin annotation (@Begin and @End control conversations).