4 Replies Latest reply on Oct 27, 2014 2:58 AM by irfani arief

    accessing jpa persistence between deployments

    irfani arief Newbie

      greetings,

      i have quite a huge development environment that i've been wanting to migrate from jboss as 5.1.0 to wildfly 8.1

      i have some ear with a lot of ejb in it (totalling at around a hundred), and some jar outside the ear that acts as a persistence and jpa entity. i set up the project this way since the jpa entities needs to be used across many different applications on the same server. In wildfly 8.1 i run into a problem that the ejb within the ear are not able to locate the persistence unit that's defined in persistence.xml inside the jar. as per the answer in How to make persistence unit visible for other deployments (not EAR) by Scott Marlow, there's no code that scans persistence unit outside of it's own deployment, so i can't use a persistence unit outside of my ear, unless i use the jndi alternative. doing this would mean that i need to change all the classes in my ejb to use jndi rather than the usual annotation way.

       

      Is there any workaround about this issue? and why does wildfly built this way? is there any security or performance reason that accessing other deployments persistence might bring?

       

       

      thanks in advance for the answers, cheers