JBoss Seam: How to Open jpa/hibernate session in view

筅森魡賤 提交于 2019-12-08 12:35:20

问题


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

回答1:


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).



来源:https://stackoverflow.com/questions/6902786/jboss-seam-how-to-open-jpa-hibernate-session-in-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!