[jboss-user] [JBoss Seam] - When to use @PersistenceContext vrs @In EntityManager (SMPC)
do-not-reply at jboss.com
Wed Feb 6 16:54:12 EST 2008
I've been experiencing some problems since switching to seam 2 with anonymous wrote : org.hibernate.LazyInitializationException: could not initialize proxy - no Session
Is my understanding correct:
One should use a SMPC in Seam components that are *not* session beans.
@In EntityManager entityManager
For stateful session beans (that may or may not be seam components) one should use:
For stateless session beans (that may or may not be seam components) one should use:
The problem I'm experiencing is that I have a SFSB using an entityManager annotated with @PersistenceContext(type=EXTENDED). Some operations on entities produce the LazyInitializationException. If I switch to a Conversation Scoped Seam component, and start a long running conversation, then these exceptions go away.
This class is just meant to be a SFSB (Session Scope) though, not Conversation scoped. Am I wrong in thinking that the PersistenceContext(type=EXTENDED) should stay around as long as the bean is alive, and thus not produce LIEs?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127190#4127190
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127190
More information about the jboss-user