开发者

JPA ManyToMany problem

开发者 https://www.devze.com 2022-12-28 16:32 出处:网络
Hello i have an Entity Exam @Id @Gen开发者_如何转开发eratedValue(strategy=GenerationType.TABLE)

Hello i have an Entity Exam

 @Id
    @Gen开发者_如何转开发eratedValue(strategy=GenerationType.TABLE)
    private Long id;
    .....
    ......

    @ManyToMany
    private List<Exam> exams;

    @ManyToMany(mappedBy="id")
    private List<Exam> parentExams;

The problem is that

@ManyToMany
        private List<Exam> exams;

is ok works great...

but this doesnt validate?!

 @ManyToMany(mappedBy="id")
        private List<Exam> parentExams;

Any idea what to do ? I just want to get the exams that are parents of the current exam.

Διεθνές Νομισματικό Ταμείο


SOLVED.

mappedBy="id" should be mappedBy="exams"

0

精彩评论

暂无评论...
验证码 换一张
取 消