Hibernate: Used mappedBy on class that extends another class annotated as JoinedSubclass?

后端 未结 3 1561
迷失自我
迷失自我 2021-02-19 09:46

The following doesn\'t work:

@Entity
class Owner {

  @OneToMany(mappedBy=\"owner\", cascade = {CascadeType.ALL})
  protected Set getBSet() {
    ..
  }         


        
3条回答
  •  广开言路
    2021-02-19 10:13

    Try adding targetEntity = Transaction.class. This worked for me when I was using SINGLE_TABLE inheritance. I didn't try it with JOIN.

    @Entity
    class Owner {
    
      @OneToMany(mappedBy="owner", cascade = {CascadeType.ALL}, targetEntity = Transaction.class)
      @Where(clause = "tableType='I'")
      protected Set getBSet() {
        ..
      }
    
    }
    

提交回复
热议问题