[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Multiple EntityManagers

lightbulb432 do-not-reply at jboss.com
Sat Oct 7 02:28:59 EDT 2006


If you inject multiple EntityManagers into the same class with different persistence units, I assume that would allow for persisting objects to different databases within the same class.

What I'm wondering about is the ability to inject multiple EntityManagers or EntityManagerFactory with the SAME persistence unit in the same class. What purpose might something like this hypothetically serve?

I saw an example where one class had one injected EntityManager of a given persistence unit, and a created EntityManager (from EntityManagerFactory.createEntityManager() where the EntityManagerFactory has the same persistence unit).

What purpose would either of these scenarios have...multiple EntityManagers (either injected directly or through the EntityManagerFactory) with the SAME persistence unit in one class?

I'm confused on this issue because I can't see what the purpose of the same persistence unit would be...couldn't even guess...

Thanks.

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

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



More information about the jboss-user mailing list