Computer Science, asked by sabika9894, 1 year ago

What is definition for one to many many to one in hibernate?

Answers

Answered by rahul2163
1
One-to-Many: One Person Has Many Skills, a Skill is not reused between Person(s)

Unidirectional: A Person can directly reference Skills via its SetBidirectional: Each "child" Skill has a single pointer back up to the Person (which is not shown in your code)

Many-to-Many: One Person Has Many Skills, a Skill is reused between Person(s)

Unidirectional: A Person can directly reference Skills via its SetBidirectional: A Skill has a Set of Person(s) which relate to it. please mark as a brain list I hope it will help you
Answered by PrinceJK786
1
When you model your database, you will most likely define several many-to-one or one-to-many associations. And it’s, of course, the same when you model your entities. It’s quite easy to do that with JPA and Hibernate. You just need an attribute that represents the association and annotate it with a @ManyToOne or @OneToMany association. But as easy as it seems, there are several pitfalls that you can avoid by following a few best practices.
Similar questions