What are the core components of Hibernate?

Hibernate's architecture is built around a small set of core components that work together to manage the connection between Java objects and the database: SessionFactory, Session, Transaction, and the underlying configuration and connection layers.

Key Points: • Configuration reads settings and entity mappings, and is used once at startup to build the SessionFactory. • SessionFactory is a thread-safe, heavyweight object created once per application (or per data source) that produces Session instances. • Session is a lightweight, single-threaded object representing one unit of work — it's the main API for CRUD operations and query execution. • Transaction represents a unit-of-work boundary, wrapping a group of operations so they commit or roll back atomically. • ConnectionProvider abstracts how Hibernate obtains JDBC connections, allowing pluggable connection pooling implementations.

Example: A typical flow builds one SessionFactory at application startup from Configuration, then for each web request opens a Session, wraps the work in a Transaction, performs save/update/query calls, commits, and closes the Session.

Interview Tip: A concise interview answer is:

"Hibernate's core components are Configuration, which builds the SessionFactory from mappings and settings; SessionFactory itself, a heavyweight, thread-safe object created once; Session, a lightweight per-unit-of-work object used for actual persistence operations; and Transaction, which wraps those operations atomically."