I am a newbie in Database design as well as in Hibernate too. I began reading through the documentation for Hibernate. It spoken about "Collection Mapping", "Association Mapping" and "Component Mapping". I'm not comprehending the distinction between them and never sure about when you should use what in a single-to-many/many-to-one/many-to-many associations. In my experience, all of them appear to complete virtually exactly the same factor...
Would you explain the differnces between "Collection Mapping", "Association Mapping" and "Component Mapping" as refered through the Hibernate doc? Good examples of when may be the better to use which mapping could be appreciated.
PS. I'm not sure if this sounds like too general of the question to request here. If you feel it's, sorry for costing you time. Any tips to a great general text or website could be good too.
Collection mapping describes a 1-to-many or many-to-many relationship which is planned while on an implementation of java.util.Collection.
Association mapping describes a many-to-one a treadmill-to-one relationship which is planned by utilizing another class that you've planned in Hibernate (also known as an "entity"). The connected object features its own lifecycle and it is simply associated with the very first object.
Component mapping describes mapping a category (or assortment of classes) whose lifecycle is bound tightly towards the parent. This is known as "composition" within the strict meaning of the term in object-oriented programming. Essentially should you remove parents object the kid object ought to be erased additionally, it cannot exist by itself with no parent.