Use statefull beans, stateless beans only live for one request-response cycle( they are
not very usefull in this way), and use @PersistenceContext(type =
PersistenceContextType.EXTENDED) on manager if you want to keep persistence context for
more than one cycle,
this way persistence context is bound to life cycle of statefull bean not just
transaction.
That way your entities will not be detached after response.
Something else there is a third way, you can bound persistence context to an conversation,
that can only be managed with seam, that way all statefull or stateless beans that live in
side conversation share the same persistence context, but you have to inject manager
| @In
| private EntityManager em;
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123859#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...