What is Hibernate?
Hibernate is an Object-Relational Mapping(ORM) solution for JAVA and it raised as an free chronic structure developed by Gavin King in 2001. It is a powerful, top rated Object-Relational Persistence and Query service for any Java Program.
Hibernate charts Java sessions to information source platforms and from Java information kinds to SQL information kinds and relieve the designer from 95% of typical information persistence related development tasks.
Hibernate sits between traditional Java things and information source server to handle everything in persisting those things based on the appropriate O/R systems and styles.
Hibernate facilitates almost all the major RDBMS. Following is list of few of the information source engines reinforced by Hibernate.
HSQL Database Engine
Hibernate facilitates a variety of other technological innovation, including the following:
Hibernate uses various existing Java APIs, like JDBC, Java Deal API(JTA), and Java Labeling and Directory Interface (JNDI). JDBC provides a standard level of abstraction of performance found in relational information source, allowing almost information source with a JDBC driver to be reinforced by Hibernate. JNDI and JTA allow Hibernate to be incorporated with J2EE application web servers.
Following section gives brief description of each of the category things involved in Hibernate Program Structure.
The Settings item is the first Hibernate item you make in any Hibernate application and usually designed only once during application initialization. It symbolizes a configuration or qualities information file required by the Hibernate. The Settings item provides two keys components:
Database Connection: This is managed through one or more configuration data files reinforced by Hibernate. These data files are hibernate.properties and hibernate.cfg.xml.
Class Mapping Setup
This component creates the outcomes of the Java sessions and information source platforms..
Configuration item is used to make a SessionFactory item which then configures Hibernate for the applying using the supplied configuration information file and allows for a Session item to be instantiated. The SessionFactory is a line safe item and used by all the discussions of a software.
The SessionFactory is high quality item so usually it is made during application start up and kept for later use. You would need one SessionFactory item per information source using a separate configuration information file. So if you are using several information source then you would have to make several SessionFactory things.
A Session is used to get a physical experience with a data source. The Session object is light and portable and designed to be instantiated everytime an connections is required with the data source. Chronic things are stored and recovered through a Session item.
The session things should not be kept open for a long time because they are not usually line safe and they should be designed and damaged them as required.
A Deal symbolizes a device of work with the data source and most of the RDBMS facilitates transaction performance. Dealings in Hibernate are addressed by a transaction administrator and transaction (from JDBC or JTA).
This is an optionally available item and Hibernate programs may choose not to use this interface, instead handling transactions in their own application rule.
Query things use SQL or Hibernate Query Language (HQL) sequence to recover data from the data source and create things. A Query example is used to combine query factors, restrict the number of results came back by the query, last but not least to perform the query.