0 Replies Latest reply on Feb 18, 2016 11:50 AM by brancoveanu

    DefaultRevisionEntity - extending it fails JPA validation - entity has no primary key attribute defined

    brancoveanu

      Dear adamw

       

      As I read on the Hibernate Envers 4.2 site
      Chapter 15. Envers

      for a revision log, in order to implement a custom @RevisionEntity, there are 2 solutions:

      1. extend DefaultRevisionEntity class
      2. implement from scratch the new class without extending DefaultRevisionEntity.

       

      I tried solution 1 but it failed - there's a JPA validation failed in my JBoss Dev Studio: The entity has no primary key attribute defined

      When I looked in the source code of DefaultRevisionEntity I saw that the attributes are private, not protected:

      @Id

          @GeneratedValue

          @RevisionNumber

          private int id;

       

          @RevisionTimestamp

          private long timestamp;

       

      So this is the source of the error.

      Why don't you make the above attributes protected ? Or set the above annotations on property level ?