1 Reply Latest reply on Jul 16, 2009 9:22 AM by Adam Warski

    RevisionListener is not being called

    Muhammed Patel Newbie

      Hi there,

      Hopefully this is the last question for this. :)

      I have a class that implements the revisionlistener

      package za.co.aforbes.fpc.db.model;
      import org.hibernate.envers.RevisionListener;
      import za.co.aforbes.fpc.db.model.user.User;
      import za.co.aforbes.fpc.ui.bean.ManagedBean;
      import za.co.aforbes.fpc.ui.util.FacesUtils;
      public class MyListener implements RevisionListener{
       public void newRevision(Object obj) {
       MyTestEntity n = (MyTestEntity)obj;

      and an entity

      package za.co.aforbes.fpc.db.model;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.Id;
      import org.hibernate.envers.RevisionEntity;
      import org.hibernate.envers.RevisionNumber;
      import org.hibernate.envers.RevisionTimestamp;
      public class MyTestEntity {
       private int id;
       private long timestamp;
       private String usernameModified;
       public int getId() {
       return id;
       public void setId(int id) {
       this.id = id;
       public long getTimestamp() {
       return timestamp;
       public void setTimestamp(long timestamp) {
       this.timestamp = timestamp;
       public String getUsernameModified() {
       return usernameModified;
       public void setUsernameModified(String usernameModified) {
       this.usernameModified = usernameModified;

      But when i update any thing my audit tables are being updated but my listener is not being called.


      1. Is my entity supposed to be mapped in my hibernate.cfg.xml file for it to register?

      2. If not how do i register the Entity in my application?

      Thanks ,
      Muhammed Patel