Posted by Amarjeet Kumar | Last Updated: 05-Jan-19
It basically describes the synchronization between Java objects and Database tables and How the Hibernate Framework handles all this synchronization process.
- If the modification done in objects are reflecting to table rows and vice-versa then it is called synchronization. Hibernate framework takes care of this synchronization by taking the support of JDBC code and SQL queries internally.
- Every Java object is identified by JVM through hashcode, similarly, every object of domain class will be identified by the Hibernate through identity value or identifier value. This value is generated based on the identifier field or property configuration done in the mapping file. We configure one or other property of domain class as identifier field or identity field.
- Hibernate framework generates "Update" query having domain class object identifier value as the criteria value to synchronize the changes done in the object to the database table row. Similarly, it generates "Select" query having identifier value as criteria value to synchronize changes done in a Database table row to object.
- Using o-r mapping to map more java classes of Java Application with more Database tables of Database software and we can go for objects based Database software independent persistence logic development without using any SQL Queries. This also makes the o-r mapping persistence logic as portable persistence logic across the multiple Database Softwares.
O-R mapping configurations
This post mainly focused on the relationship between Java objects and how the changes are done in Java object reflects the database table and vice-versa.