Table of Contents
Definition Hibernate
Hibernate is (ORM) an object-relational mapping tool for the Java platform (and also available for Net with the name of NHibernate) that facilitates the mapping of attributes between a traditional relational database and the object model of an application, through declarative files (XML) or annotation in the beans of the entities that allow to establish these relations.
Hibernate is a framework that speeds up the relationship between application and database. You need basic database knowledge and SQL to handle Java language.
Uses of Hibernate
When we develop applications in many cases, everything ends up being a set of ABM (high, low, and data modifications) that we then consult. For this, a database helps us where there are many repeated tasks. For each object that I want to persist. I must create a class that allows me to insert it, delete it, modify it and consult it.
Except for individual inquiries, the rest is always the same. It is the moment where an ORM is of fundamental importance. By merely configuring it, all these tasks get executed automatically, and you only have to worry about individual queries.
How does Hibernate work?
Developer configures an XML file, or with annotations, an element of the class corresponds with a column of the table. It is a simple task where there are tools that do it for us.
Features of Hibernate
Simplicity and Flexibility
You need a single configuration file at runtime and a mapping document for each application. This file can be the Java standard (properties extension) or an XML file. There is also the alternative of making the configuration programmatically. The use of persistence frameworks.
Such as EJBs, makes the application dependent on the structure. Hibernate does not create that additional dependency. Persistent objects in the application do not have to inherit from a Hibernate class or obey a specific semantics. Nor does it need a container to work.