6 Replies Latest reply on Feb 2, 2007 1:02 PM by Andrew Rubinger

    Two databases, two persistence-units but one entity jar-file

    Ville Ingman Newbie

      Hi all,

      This message was initially sent to Hibernate forums, but Emmanuel from the Hibernate Team suggested to post this it here. Hibernate thread is http://forum.hibernate.org/viewtopic.php?p=2338630.


      I'm trying to create two different database schemas from one entity jar-file. The point is that I need one DB for the actual data and exactly identical DB for backup purposes etc. My operative DB works just fine and all tables are created, but the problem is that my backup DB remains empty without any errors from Hibernate. I get no tables, no errors, no warnings and nothing seems to be wrong in log-files either. The other DB just remains empty.

      Log-file is identical with both of these persistence-units. Hibernate tells me that this-n-that table not found in database etc and it leads to table creation in my operative database, like it should be. Nothing, absolutely nothing, happens to my backup persistence-unit.

      I have JBoss 4.0.5.GA and Hibernate 3.2.1.GA. Both databases are empty and listed in deploy/postgres-ds.xml and they do exist before JBoss launch. My app is packed inside an EAR and my EJB-module has this persistence.xml listed below.

      My persistence.xml:

      <persistence-unit name="my-operative-db">
      <jta-data-source>java:/my-operative-db</jta-data-source>
      <jar-file>../entity-data.jar</jar-file>
      <properties...
      </persistence-unit>
      <persistence-unit name="my-backup-db">
      <jta-data-source>java:/my-backup-db</jta-data-source>
      <jar-file>../entity-data.jar</jar-file>
      <properties...
      </persistence-unit>

      Does any one have similar problems? Am I missing something or is there something wrong in JBoss/Hibernate? Some one please try this out and post your comments.

      I didn't open a JIRA issue on this yet. I'd like to wait if someone has more info on this and perhaps a JIRA issue isn't needed. Atleat I keep my fingers crossed on that. :)

      Thanks for advance,
      Ville