What is the difference between the different display types in Hibernate?

I am new to database design and to Hibernate. I started reading documentation for Hibernate. It talked about Map Mapping, Map Mapping, and Component Mapping. I do not understand the difference between them and am not sure when to use what is in the one-to-many / many-to-one / many-to-many relationship. For me, they all seem to do almost the same thing ...

Could you explain the differences between Map Mapping, Association Mapping, and Component Mapping , as stated in the Hibernate document? Examples of when it is best to use which comparison will be evaluated.

PS. I do not know if this is too general a question to ask here. If you think so, sorry for wasting your time. Any suggestions for a good general text or website would be good too.

Thanks!

+4
source share
1 answer
  • Displaying a collection refers to a one-to-many or many-to-many relationship that will be displayed using the java.util.Collection implementation.

  • Association mapping refers to many-to-one or one-to-one relationships that will be displayed using another class that you have mapped in Hibernate (also called an "entity"). A linked object has its own life cycle and is simply connected to the first object.

  • Component mapping refers to the mapping of a class (or set of classes) whose life cycle is closely related to the parent. It is also called โ€œcompositionโ€ in the strict definition of a word in object-oriented programming. Basically, if you delete a parent, the child must also be deleted; he also cannot exist independently without a parent.

+7
source

All Articles