Object/relational mapping (ORM) is the process of persisting objects in a relational database. ORM bridges the gap between object and relational schemas,allowing your application to persist objects directly without requiring you to convert objects to and from a relational format.There are many types of ORM solutions, offering varying levels of mapping support. Some ORM frameworks require that persistent objects inherit from a base class or perform post-processing of bytecode.
Hibernate, on the other hand, requires a small amount of metadata for each persistent object. Hibernate is a noninvasive ORM service. It doesn’t require bytecode processing or a base persistent class. Hibernate operates independently of application architecture, allowing it to be used in various applications. It provides full object/relational mapping, meaning that it supports all the available object-oriented features that relational databases lack.
Developers accustomed to using the standard JDBC API may wonder why a tool like Hibernate is needed. After all, JDBC provides a simple and complete interface to relational databases. Using JDBC directly is ideal for basic applications, since you can quickly persist objects with well-understood code. However, JDBC can get out of hand with larger applications or when requirements change. If an object changes, the code that persists the object must be changed and tested, as well as all the SQL used to manage the object’s state. Using Hibernate for application persistence helps avoid the drawbacks of raw JDBC.ORM is a good solution for legacy databases when the schema:
Is highly normalized.
Has primary keys.
Has foreign key relationships referring to primary keys, not columns.