1 Reply Latest reply on Apr 12, 2009 10:12 PM by fenixx

    Using two databases..

    John Public Newbie

      This is a new area for me...

      How do I configure my application to use two databases. I have all application data in one database and all other less important stuff in another. Do I need to change persistence-{dev/prod/test}.xml and {appname.-(prod/dev/test)}.xml. How do I get Hibernate to get data from the right database?

      Thanks in advance for the help.


        • 1. Re: Using two databases..

          First, you have do declare two different persitence units in your persistence.xml file(s).
          After that you need to use

          EntityManager em;

          As you see: The name of the persistence unit is important which database you want to use.