Hibernate - (Part 1): Introduction
On November 23,2023 by Tom RoutleyHibernate is a layer residing in the JVM to ensure the mapping Hidden Java objects in the JVM of (relational or data model). Hibernate also ensures the transfer of Java classes in the data entities, including data object in the entities and tables.
Hibernate also provides a language for manipulating objects mapped known as HQL. The goal to make Select, Update and Delete, using count, average..and other operations. HQL also has its limitations such as the use of the union operator. In the layer closest to the database, Hibernate uses JDBC (JDBC Template) to interact with the database.
The figure below depicts the components of Hibernate interacting with a database and the configuration components to provide the developer of a JAVA application with persistent objects to transport data between the objects and tables in the database.
Several tools for mapping (object/relational) exist in Hibernate community.
The loading of a mapped object of the database or update (Update, insert, delete) can be done if a Hibernate session is instantiated. The session layer is represented by the JAVA org.hibernate.Session interface.
For the developer of a Java application, the Hibernate activities starts after the following instruction:
session = sessionFactorpenSession ()
where sessionFactory is an object created by the application that uses the JDBC connection (or JNDI).
The Hibernate activities ends after method call
sessionlose ()
Between these two methods mentioned above, a transaction can be initiated by calling
session.beginTransaction().
Hibernate version 3 can be downloaded from the link
The main jars are:
Ehcache-1.3.0.jar: Used by hibernate (second cache)
Hibernate-3.2.5.ga.jar: used by hibernate
Hibernate-annotations-3.3.0.ga.jar: Used for the jpa annotation
Hibernate-commons-annotations-3.3.0.ga.jar: Used for the jpa annotation
Hibernate-entitymanager.jar: Used for the jpa annotation
Hibernate-validator-3.0.0.ga.jar: for layer validation - hibernate validator (required fields, length, ..)
The .hibernatefg.Configuration class.
The Configuration constructor make use of the Hibernate configuration file (hibernatefg.xml.).
The org.hibernate.SessionFactory class
Virtually all Hibernate methods can trigger this exception.
Interface org.hibernate.SessionFactory
This is the first instance created:
new org.hibernatefg.Configuration onfigure ().buildSessionFactory ();
It allows reading hbm files (see the configuration section).
org.hibernate.Session class
org.hibernate.Query class
The classes that allows a developer to write the Hibernate query (HQL) using the JAVA objects.
org.hibernate.SQLQuery class
A class that allows a developer to write SQL queries.
org.hibernate.Transaction class
This is the Hibernate transaction object: commit() and rollback() functions.
Article Recommendations
Latest articles
Popular Articles
Archives
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- January 2021
Leave a Reply