-
1. Re: Override EJB annotation in EAR
wolfc Jan 13, 2010 7:08 AM (in response to thomasgo)Would defining the persistence unit on EAR level help out? -
2. Re: Override EJB annotation in EAR
thomasgo Jan 13, 2010 10:26 AM (in response to wolfc)Well, we already define the persistence units in a separate persistence.xml, i.e.
EAR
- persistence.jar
-- persistence.xml -> references the entity jar's via <jar-file>
- dao-service.jar
-- daoService -> entity manager ref
The problem is that our jar files represent components that might be reused in different applications.
However, each application might define different persistence units that the components should reside in.
I could set a different persistence unit per component jar but then I'd have many units in persistence.xml.Additionally, I'm not sure that if each unit references only a subset of the entities, queries like "select A.b from A" would work in cases where A is in PU "A" and B or A.b is registered in PU "B". Plus registering A and B in both units doesn't seem that good (which unit is the owner? are the instances shared? etc.)