8 Replies Latest reply on Jul 1, 2011 11:26 AM by Adam Warski

    JoinColumn with SecondaryTable and SingleTable inheritance

    Yasen Terziivanov Newbie

      Hi,

      I have an entity (A) that extens from another (B) and a SingleTable inheritence strategy is used.

      In A there is a one to one association with JoinColumn annotation spcifying that the key shoud be kept in the table for A.

       

      @Inheritance(strategy = InheritanceType.SINGLE_TABLE)

      class B {

           ....

      }

       

      @SecondaryTable(name = "a_table", pkJoinColumns = @PrimaryKeyJoinColumn(name = "b_id"))

      class A extends B {

       

           @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
           @JoinColumn(name = "c_id", table = "a_table")

           private C cField;

      }

       

      when I use hbm2ddl to generate the schema the audit table for A is missing the column "c_id".

      Is there any way to tell envers that the key for C must be in the audit table for A ?

       

      Thanks.