问题
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