Tech talks are knowledge sharing sessions conducted bi-weekly at NovelVox. This week, we had a session on Hibernate conducted by Bilal Ahmad and Prashant Aggarwal on August 26, 2020.

About Hibernate

Hibernate is an Object Relational Mapping tool used for the Java programming language. It simplifies the development of Java application by providing a framework for mapping objects to the data stored in the database. This Open Source, lightweight ORM Tool developed by Gavin King is popularly known for simplifying data creation, data manipulation, and data access.

Hibernate

Advantages of using Hibernate

There are a couple of ORM Tools available in the market committed to offering the same mapping features. The reason why Hibernate is the most-widely used ORM tool among all can be seen as follows:

  • It is fast performing ORM tools
  • It provides a Database Independent Query Language
  • It supports Automatic Table Creation
  • It simplifies complex Joins
  • It uses the cache concept internally.
  • It is highly configurable and extensible.

Hibernate Architecture

Hibernate

The Hibernate architecture can be seen depicting configuration details and various objects involved in each layer. One can see that the framework creates a layer between the Database and the application, and loads the configuration details like Database connection string and entity mappings files.

Elements of Hibernate Architecture

  • Sessions
    The role of Session in the architecture is to provide an interface between the application and data stored in the database. It’s a single-threaded, short-lived object which acts as a bridge between Java application and Hibernates.
  • Session Factory
    Sessions are created by Session Factory, it is a thread-safe and immutable object representing the mappings for a single database. Session Factory is generally one per DB.
  • Transaction
    In the architecture, transactions can be seen as a set of instructions, treated as a single unit of work. They are obtained from the Session object and should execute either completely or no part of it.

Practical Sessions

Apart from sharing his valuable knowledge on Hibernate, the host also took a practical session wherein the NovelVoxians were introduced to the following test cases:

  • Hibernate Configurations files
  • Hands-on Coding
  • HQL and HCQL Implementation

This was a snippet of our last tech talk session conducted by Bilal Ahmad and Prashant Aggarwal. It was a really knowledgeable session for all the NovelVoxians as they get to learn about the ins and outs of Hibernate.