3 Replies Latest reply on Jul 24, 2008 11:01 AM by skajotde

    customize name of persistence.xml

    skajotde

      Hi

      I have many projects with settings for ear deployed on jboss server (eg have files META-INF/persistence.xml). Now I'm trying run junit test from eclipse with jboss embedded. For tests simplest solution what come to my mind is deploying persistence-test.xml which doesn't interact with server deployment. Does ejb3 allow to customize persistence.xml file name ?

      I know that in spring it can be done via attribute of bean in IoC ;)

        • 1. Re: customize name of persistence.xml
          skajotde

          I know that is option with :

           // AssembledDirectory jar = AssembledContextFactory.getInstance().create("ejbTestCase.jar");
           // jar.addClass(Customer.class);
           // jar.addClass(CustomerDAOBean.class);
           // jar.addClass(CustomerDAOLocal.class);
           // jar.addClass(CustomerDAORemote.class);
           // jar.mkdir("META-INF").addResource("tutorial-persistence.xml", "persistence.xml");
          


          In this persistence.xml is alias for additional file but unfortunately jboss embedded with hibernate doesn't work with vfs ;/

          • 2. Re: customize name of persistence.xml
            skajotde

            There is solution what I had seek ;)

            In file /testejb3-jbossembedded-beta3/src/main/jbossembeddedconf/deployers/ejb3-deployers-beans.xml (file from jboss embedded) I had to add line in bean PersistenceUnitParsingDeployer.

            <property name="name">persistence-integration-tests.xml</property>
            


            PersistenceUnitParsingDeployer is cool ;)




            • 3. Re: customize name of persistence.xml
              skajotde

               

              "skajotde" wrote:

              In this persistence.xml is alias for additional file but unfortunately jboss embedded with hibernate doesn't work with vfs ;/


              https://jira.jboss.org/jira/browse/EJBTHREE-1254 - Exploded jar (inside EAR) containing persistence.xml with jar-file element fails to deploy