FANDOM


Hibernate is a tool which handles easy interaction of the application with the database. When said 'database', it involves multiple tables, and each table might be inter-related with one another. This inter-relation between the tables in terms of Java can be said as entity relationship (the relationship between entities). Having said this, I mean that for every table in the database, we have a corresponding entity in our Java application as well.  Hibernate eases out the effort of Java developers, by asking them to just create a entity mapping xml for each of the entities available in the application (That's easy to count once you know what you are creating). So for Student.java, Hibernate asks to create a Student.hbm.xml file, which must contain all the mappings of its own properties to the corresponding column in the student table, as well as the mappings denoting its relationship with other entities (such as Department). Like a Student table might be associated with a department table, and we can say, a single department can definitely have many students. So we can clearly derive a one to many relationship[1] relationship out of it. That is what we mention in the mapping xml file of student (Student.hbm.xml), the mapping of its properties to the corresponding columns in the database table, and relationship of student with the department entity (many-to-one). Hibernate features are massive in several ways. It can frame queries for us internally, such that when we query for a Student, we can also configure to get the associated department. Similarly, if we query for a particular department, hibernate also provides to return the associated students in that department as well. So such hibernate mappings save the developer from writing complex SQL queries, thus saving both effort and time. Hibernate configuration and mappings are comparatively easy to learn and understand.

Hibernate Referenes:

Hibernate Tutorials

Inheitance in Hibernate

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.