2 Replies Latest reply on Jun 1, 2010 4:40 AM by Philipp Schill

    Envers & Self-Referencing Entities

    Philipp Schill Newbie

      Hello

       

      does anyone know how to create a self-referencing entity with Hibernate Envers support?

       

      My Entity would be:
      @Entity
      @Audited
      @Table(name = "XMODEL")
      @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
      @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING)
      @DiscriminatorValue("XMODELOBJECT")
      public class XModelObject {
          @Id
          @GeneratedValue(strategy = GenerationType.AUTO)
          private Long id;
         
          @Column(nullable = false, unique = false)
          private String name;
         
          @ManyToOne
          private XModelObject parent;

       

          public Long getId() {
              return id;
          }
          public String getName() {
              return name;
          }
          public XModelObject getParent() {
              return parent;
          }
          public void setId(Long id) {
              this.id = id;
          }
          public void setName(String name) {
              this.name = name;
          }
          public void setParent(XModelObject parent) {
              this.parent = parent;
          }
      }

       

      Currently, no revision is inserted into the _AUD table