What are the Core Interfaces are of Hibernate Framework

The core interfaces are used in just about every Hibernate application. Using these interfaces, you can store and retrieve persistent objects and control transactions.

  • Session interface
  • SessionFactory interface
  • Transaction interface
  • Query and Criteria interfaces

Hibernate is a popular object-relational mapping (ORM) framework for Java, and it provides several core interfaces that play key roles in its functionality. Here are some of the core interfaces of the Hibernate framework:

  1. Session: The Session interface is a runtime interface between a Java application and Hibernate. It provides methods for CRUD (Create, Read, Update, Delete) operations, as well as other operations like querying the database.
  2. SessionFactory: The SessionFactory interface is used to create sessions. It is a heavyweight object and should be instantiated once per application. The SessionFactory is responsible for managing the Hibernate Session objects.
  3. Configuration: The Configuration interface is used to configure and bootstrap Hibernate. It represents a configuration settings and properties that Hibernate will use to connect to the database.
  4. Transaction: The Transaction interface represents a single unit of work and abstracts the code from the underlying transaction management system (JTA or JDBC). It allows developers to control the boundaries of transactions.
  5. Query and Criteria: Hibernate provides two interfaces for querying the database – Query and Criteria. The Query interface allows you to execute HQL (Hibernate Query Language) queries, while the Criteria interface allows you to create and execute queries using a programmatic and type-safe approach.

These are some of the core interfaces in Hibernate, and understanding their roles and usage is crucial for working effectively with the framework.