9 Replies Latest reply on Jul 6, 2010 2:31 AM by Adam Warski

    Getting NotAuditedException using the entity name concept of

    asdf asdf Newbie

      I have employee entity which is configured as an entity name (As shown in the configuration).It saves and audits data properly, but while retrieving the audited information using entity class with AuditReader, i am getting the following error.

      Exception in thread "main" org.hibernate.envers.exception.NotAuditedException: domainobjects.Employee is not versioned!
      at org.hibernate.envers.reader.AuditReaderImpl.getRevisions(AuditReaderImpl.java:126)
      at test.TestAuditLogs.displayEmployRevisionInfo(TestAuditLogs.java:696)
      at test.TestAuditLogs.addEmployees(TestAuditLogs.java:679)
      at test.TestAuditLogs.main(TestAuditLogs.java:106)

      <class name="domainobjects.Employee" table="EMPLOYEE" entity-name="emp">
       <id name="id" column="ID" type="long">
       <generator class="increment" />
       <property name="empName" type="string">
       <column name="NAME" />
       <property name="empDesc" type="string">
       <column name="description" />
       <property name="empNo" type="string">
       <column name="empNo" />
      Saving the employee object using entity name:
      session.persist("emp", empObject);
      Getting the error using below methods:
      1). List revisionList = reader.getRevisions(Employee.class, 101);
      2). Object emp = reader.find(Employee.class, 3, 889);

      In the 'AuditReaderImpl', entity name is refered as the class name in all the above methods, i feel this might be the problem for this case.
      It would be great to have the entity name support for the envers.