2 Replies Latest reply on Feb 22, 2010 12:02 PM by Luis Rodríguez Fernández

    RevisionEntity with Spring

    William Conroy Newbie

      I am using envers and spring/jpa and basic auditing is working well so far.  I would like to implement the revision entity example you have in the documentation, but it does not appear to be working.  I have the following 2 classes.

       

      I dropped all my tables, then started up my server.  It made the default REVINFO table again and I dont see the USER_REV_INFO.  When running with the spring/jpa configuration is there anything extra I need to do other than adding the revision entity?  If i turn on debug logging, is there any message I can look for to see if it picked up my @RevisionEntity properly?  Please let me know if you need any more information.

       

      Thanks,

       

      Bo

       

      @Entity
      @Table(name = "USER_REV_INFO")
      @RevisionEntity(value=MyRevisionListener.class)
      public class MyRevisionEntity extends DefaultRevisionEntity {

       

          @Column(name="user_name")
          protected String userName;

       

          public String getUserName() {
              return userName;
          }

       

          public void setUserName(String userName) {
              this.userName = userName;
          }
      }

      public class MyRevisionListener implements RevisionListener {

       

          @Override
          public void newRevision(Object revisionEntity) {
              MyRevisionEntity locateEntity = (MyRevisionEntity)revisionEntity;

       

              locateEntity.setUserName("SomeUser");
          }

       

         
      }