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...
In addition to the above question, I have a question about persistence units:
Is a given persistence unit specific to a given database, or to a set of classes for which it is responsible for persisting?