What is ORM? Explain object/relational mappings in hibernate
Object-Relational Mapping
-
It is a programming technique for converting object-type data of an object oriented programming language into database tables.
-
Hibernate is used to convert object data in JAVA to relational database tables.
Hibernate O/R Mapping
-
Three most important mapping are as follows:
- Collections Mappings
- Association Mappings
- Component Mappings
-
Collections Mapping
-
Association Mappings
-
Component Mappings:
-
If the referred class does not have it's own life cycle and completely depends on the life cycle of the owning entity class, then the referred class hence therefore is called as the Component class.
-
The mapping of Collection of Components is also possible in a similar way just as the mapping of regular Collections with minor configuration differences.