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

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

    da3x

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


      org.jboss.envers
      jboss-envers
      1.2.0.GA-hibernate-3.3


      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) {
       System.out.println(p);
       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:

      [img]http://photos-1.getdropbox.com/i/o/hkaBJV579VwPcpu-JyUHiz9VGPfnOaEV83Behnm_WRQ[/img]

      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:

      [img]http://photos-1.getdropbox.com/i/o/L5NyRYROa4iJYGReWsY4i-yFiNFQ5haQTnW6r6t9g1I[/img]