How to handle JPA annotations for a pointer to a generic interface

前端 未结 3 1891
忘了有多久
忘了有多久 2021-01-18 01:29

I have a generic class that is also a mapped super class that has a private field that holds a pointer to another object of the same type:

@MappedSuperclass
         


        
3条回答
  •  耶瑟儿~
    2021-01-18 02:02

    You can add a @OneToOne(targetEntity=SuperClassOfT.class) to your fields to make this work.

    Check out How to implement polymorphic JPA entities with generic relations

提交回复
热议问题