[jboss-user] [JBoss Seam] - Re: When to use @PersistenceContext vrs @In EntityManager (S

reind do-not-reply at jboss.com
Wed Feb 6 18:57:16 EST 2008


I've also noticed that if I find an entity using a EJB PersistenceContext EM, then I get LazyInitializationExceptions when trying to fetch a property of that entity in another bean that uses the SMPC EM.

The only way I've found around this is to re-fetch the entity using the current EM.

This seams highly non-ideal. What's the proper approach in this case? If I don't want to start a long-running conversation in an SFSB then the only way to keep the em session going across multiple invocations is by using the EJB3 Extended PC, but then these entities are non-transferable to other seam components (where they'll produce LIEs).

It seems one must use all Extended PC or all SMPC or refetch the entity with the current EM:
entity = em.find(Foo.class, entity.getId());

Or am I missing something?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127217#4127217

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127217



More information about the jboss-user mailing list