4 Replies Latest reply on Sep 14, 2009 2:06 PM by Daniel Bleisteiner

    older revision can't traverse audited references... why?

    Daniel Bleisteiner Newbie

      I'm having trouble with my versioned entites. We are using the following version of envers:


      An entity named "Proposal" references other entities like and "OrganizaitionUnit" or "StaffMember". I'm trying to load older revisions of that Proposal and want to print out some references to verify the versioning of that data. Here is my quite simple code:

       private void testEnvers() {
       Proposal p = this.getSelectedProposal();
       if (p != null) {
       List<Number> revs = AuditReaderFactory.get(this.em).getRevisions(p.getClass(), p.getId());
       for (Number rev : revs) {
       try {
       System.out.println(" rev = " + rev);
       Proposal he = AuditReaderFactory.get(this.em).find(p.getClass(), p.getId(), rev);
       System.out.println(" " + he);
       System.out.println(" he.getIntermediateBody() = " + he.getIntermediateBody());
       System.out.println(" he.getIntermediateBodyContactPerson() = " + he.getIntermediateBodyContactPerson());
       System.out.println(" he.getStatus() = " + he.getStatus());
       catch (Exception ex) {
       System.err.println(" ! " + ex.getMessage());

      The Resulting output is the following:


      What is going wrong here? The Envers table in the database shows valid references that I'd expect to show up - but it tried to load entities with a null id... any idea?

      Here is a screencapture of the related versioning table: