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

    accessing jpa persistence between deployments

    funster

      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

        • 1. Re: accessing jpa persistence between deployments
          smarlow

          As of yet, I have not heard of any security or performance reasons for not allowing this.  A few years ago, we discussed this on the as-dev mailing list.  It is theoretically possible but the result would be an extension that is not part of the EE standard.

           

          If you or anyone else is seriously interested in contributing a code change to allow this.  There will be a learning curve that will start with solving other issues first.  I had a volunteer once before for doing this change but we didn't properly address the learning curve part (by having them work on easier jiras first).  I understand that you probably have limited time to spend on something like this but, what do you want to see in the long run?  Your application using a feature like your looking for?  Or a change to your application.

           

          Cheers,

          Scott

          • 2. Re: accessing jpa persistence between deployments
            funster

            i would be glad to help, since in my country jboss/wildfly is used widely and it would be beneficial to me if i can understand how things works. I would also be able to create other application using the design that i have now. I'm a beginner in java EE though, but i'm no stranger to java programming itself. how do i begin?

             

            cheers

            • 3. Re: accessing jpa persistence between deployments
              smarlow

              Some initial steps:

              1. Read https://developer.jboss.org/wiki/HackingOnWildFly and get starting building WildFly from your local git repo after following the steps
              2. Get your IDE to load the WildFly project that you setup in step 1 (Intellij works well if your using that).

               

              We can help you find an issue in https://issues.jboss.org/browse/WFLY.

              • 4. Re: accessing jpa persistence between deployments
                funster

                thanks, i'll get to it asap

                 

                On Sat, Oct 25, 2014 at 2:23 AM, Scott Marlow <do-not-reply@jboss.com>