4 Replies Latest reply on Feb 10, 2009 6:10 AM by Gonzalo Ferreyra

    Problem with @VersionsJoinTable

    Gonzalo Ferreyra Newbie

      Hello I'm facing a trouble when trying to audit an entity with a bidirectional collection;

      We are using Glassfish v2 as App Server, EJB 3 for business rules layer and Hibernate for the data layer, with PostgreSQL 8.3.

      The Envers version it's 1.1.0 GA for Hibernate 3.3.

      These are the entities: (the relevant parts of them... )

      @Entity
      @Table(name="comitente")
      @Versioned
      @VersionsTable(schema="auditoria", value="comitente_auditoria")
      public class Comitente implements Serializable {
      ...
       @OneToMany(mappedBy = "comitente",
       cascade={CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE})
       @VersionsJoinTable(schema="auditoria",
       name="comitente_sede_comitente_auditoria")
       private List<SedeComitente> sedes = new ArrayList();
      
      ...
      }
      
      @Entity
      @Table(name="sede_comitente")
      @Versioned
      @VersionsTable(schema="auditoria", value="sede_comitente_auditoria")
      public class SedeComitente implements Serializable {
       @ManyToOne(fetch=FetchType.EAGER)
       @JoinColumn(name="comitente_id", nullable=false)
       private Comitente comitente;
      ...
      }
      
      


      Every time we try to persist a new instance of Comitente, we are falling in this situation...

      javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
      javax.transaction.RollbackException: Transaction marked for rollback.....
      


      It's something we are missing? When the app it's deployed, the VersionsJoinTable "auditoria.comitente_sede_comitente_auditoria" it's never created.....

      In postgres log whe coudn't get any error, so we think the problem it's in creating the vertsion of the relationship

      Thanks in advance

      Gonzalo