1 Reply Latest reply on Jan 2, 2014 10:53 AM by Loïc BIGOT

    Use persistence.xml provider jpa in my application

    Loïc BIGOT Newbie

      Hi,

      I have an application named myApplication.ear, it contains persistence.xml, differents ejb modules, one war module and differents jar in /lib.

      In /lib there is myProviderAPI.jar which contains a class MyProvider extends org.hibernate.ejb.HibernatePersistence

      I read eap 6.1 documentation and i seen when i use  jboss.as.jpa.providerModule, if a persistence provider is packaged with the application,

      this value should be "application".

      But i had tried without this property and the persistence provider class is not found on startup server, so i wrote "myApplicationName", "myApplicationName.ear", "deployment.myApplicationName", "deployment.myApplicationName.ear" and even "application", each time on server startup there is an error message for each module deployment :

      org.jboss.modules.ModuleNotFoundException: myApplicationName:main

      org.jboss.modules.ModuleNotFoundException: myApplicationName.ear:main

      org.jboss.modules.ModuleNotFoundException: deployment.myApplicationName:main

      org.jboss.modules.ModuleNotFoundException: deployment.myApplicationName.ear:main

      org.jboss.modules.ModuleNotFoundException: applicationr:main

       

      Also somebody have a solution to use my own persistence Provider extending HibernatePersistence deploying in my application?

      I m not understand how  to use apllication's Provider.

       

      Ask me if you have need more details.

       

      Thank you for help.

        • 1. Re: Use persistence.xml provider jpa in my application
          Loïc BIGOT Newbie

          For more information, i use hibernate 3 bundled.

          If somebody have same problem in the case where you use embedded provider module, my solution is to use SPI.

          for this, we need to add folder "services" in "META-INF", create a file "javax.persistence.spi.PersistenceProvider" where we write in first line "my.package.Class".

          This class declared in file must exist in application deployed (in war or lib of war ).