[jboss-user] [JBoss Seam] - How many EntityManagers and SFSBs in a web app?

SmokingAPipe do-not-reply at jboss.com
Thu Dec 7 02:51:45 EST 2006


Every object that is managed by Seam is associated with an EntityManager.  A SFSB gets its EntityManager by doing an injection of a @PersistenceContext.  Normally that PersistenceContext must be of an Extended type, so that lazy-fetched objects can be rendered without the dreaded LazyInitializationException.

Now here is the problem.  If I have multiple SFSBs in the same scope (Session), they will each end up with their own EntityManager.  Big problems happen when one SFSB tries to deal with an injected bean while that bean is currently being managed by some other EntityManager.

What do I do?   It is looking to me like I should only have ONE EntityManager for each Scope.  That means one SFSB per scope.  That seems a bit limiting, or is this really the way to do things?


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

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



More information about the jboss-user mailing list