1 Reply Latest reply on Sep 3, 2012 3:39 PM by Adam Warski

    Custom Revision Entity does not use the default audit catalog

    Eric Taix Newbie

      I'm facing a problem and I'm not able to find the solution!


      I'm using Envers 4.0.1 and I create my own Revision Entity:



      public class AuditRevision {



                // La clé primaire mais AUSSI le numéro de révision




                @Column(name = "REV_ID")

                private int id;



                // La date de révision


                @Column(name = "REV_TIMESTAMP")

                private long timestamp;



                // Quel utilisateur à générer la révision

                @Column(name = "REV_USERNAME")

                private String username;



                // Quel adresse IP est à l'origine de la révision

                @Column(name = "REV_REMOTE_IP")

                private String remoteIp;



      In the configuration file, I set the default catalog for my audited entities:


      <prop key="org.hibernate.envers.default_catalog">MY_AUDIT_CATALOG</prop>



      Everything works fine except that I'm unable to store my revision entity in the same catalog as the audited entities... The only way I found is to explicitly set the table's name and catalog:


      @Table(catalog="MY_AUDIT_CATALOG", name="AUD_REVISION_REV")



      But I don't really like this solution: I'd like to be able to change the catalog in one place (we've got a test environnement, a developper env, a production env, ...) without generating a new binary. Did I miss something ?

      I think that the Revision entity (default or custom) should use the default catalog except if it is explicitly set. So in my case if the catalog is not set it should use MY_AUDIT_CATALOG.


      Thanks for your advice