[jboss-user] [EJB 3.0] - Setting persistence JNDI name for PersistenceContext

DeanoUK do-not-reply at jboss.com
Wed Apr 23 08:37:02 EDT 2008


We have a scenario where we have a common EJB (ejbcommon.jar) and another EJB (ejbproject.jar) which references this common EJB. 

You can pretty much see the setup in this other thread:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=131583

i.e.
ejbproject.jar contains the persistence.xml, which the ejbs in ejbcommon.jar reference by using:
@PersistenceContext(unitName = "XXXejbproject.jar#our-par")

The trouble comes when we switch projects within our build and use ejbproject2.jar. The common jar is now broken.

We have several possibilities including filtering that token during the build, but this kinda breaks the maven philosphy - the ejbcommon.jar within the maven repository will be over-written every time we switch project builds.

My solution would be to force the JNDI name of the peristence unit for each of the  ejbproject.jar and ejbproject2.jar to something common like 'ejb.jar' and then reference this within the ejbcommon.jar.

Thus, how do you force the ejb jar that contains the peristence.xml to have a specific JNDI name?


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

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



More information about the jboss-user mailing list