-
1. Re: 2 EARs with the same persistence unit
thomasgo Jan 27, 2010 5:19 PM (in response to thomasgo)Never mind, I found the reason and a solution/workaround.
Seems like JBoss 4.2.3 injects an entity manager from the first found persistence unit with the given name.
Since the persistence units are stored in a hashmap, even renaming our second application broke it (it worked before, but after encountering the problem we wondered why).
So I applied the fix described in JBAS-5043 and it is working now (I'm not sure the fix is 100% correct though, since the code is too complex to fully understand it in just a couple of hours).
I also tested our app with JBoss 5.1.0 (after some refactoring, mainly du to changed packages). However, there still seems to be a problem with two persistence units having the same name, since the apps were deployed and worked correctly but during deployment the server complained about the PersistenceUnitMetadata for persistence unit 'xy' already existing ('xy' is the name of the two persistence units in different ears).