hibernate-core is the main Hibernate ORM artifact. It contains the object-relational mapping engine, the native Session and SessionFactory API, the HQL query language, and the implementation of Jakarta Persistence (JPA). If you want to map Java classes to database tables with Hibernate, this is the one dependency you must have. Everything else, such as connection pools, caching and validation, is added through separate modules.
This article explains what the artifact contains, how to declare it with current coordinates, what else you need next to it, and how Spring Boot handles it.
hibernate-corehibernate-core in Spring Boothibernate-coreThe artifact bundles the pieces required to run Hibernate:
org.hibernate.annotations, such as @Formula, @NaturalId and @UuidGenerator, which extend the standard JPA annotations.SessionFactory, Session and StatelessSession APIs, and the JPA EntityManagerFactory and EntityManager implementation built on top of them.The JPA interfaces themselves (jakarta.persistence.*) come from the separate jakarta.persistence-api artifact, which hibernate-core depends on and brings in transitively.
Since Hibernate ORM 6.0 the Maven group ID is org.hibernate.orm. The older org.hibernate:hibernate-core coordinates stop at the 5.x line, and 5.x uses the javax.persistence package instead of jakarta.persistence. Check the latest release on the Hibernate site before copying a version number.
Hibernate ORM 6 requires Java 11 or later, and Hibernate ORM 7 requires Java 17 or later. Hibernate 6 implements Jakarta Persistence 3.1, and Hibernate 7 implements Jakarta Persistence 3.2.
hibernate-core alone does not talk to a database. A typical project adds:
| Need | Dependency |
|---|---|
| Database access | A JDBC driver for your database, for example PostgreSQL or MySQL |
| Connection pooling | hibernate-hikaricp, or a pool configured by your framework |
| Bean Validation | hibernate-validator (a separate Hibernate project) |
| Second-level cache | hibernate-jcache with a JCache provider |
| Audit history | hibernate-envers |
| Spatial types | hibernate-spatial |
| Compile-time metamodel | hibernate-jpamodelgen as an annotation processor |
Hibernate's built-in connection handling is meant for tests and demos, so use a pool in production.
The example uses plain JPA bootstrapping with an in-memory H2 database, so you can run it without Spring. Add the H2 driver as a test or runtime dependency.
The persistence unit demo is defined in META-INF/persistence.xml:
hibernate.hbm2ddl.auto=create-drop is for experiments. In production use a migration tool such as Flyway or Liquibase and, at most, set the value to validate.
Hibernate also offers its own API, which gives access to features beyond JPA, such as StatelessSession for bulk work and natural-ID loading.
Settings are read from hibernate.properties, or hibernate.cfg.xml when you call configure(). In Hibernate 6 and later you can also call session.persist and session.remove; the older save, update and saveOrUpdate methods were deprecated and removed in later releases, so migrate those calls.
hibernate-core in Spring BootYou rarely declare hibernate-core yourself in a Spring Boot project. spring-boot-starter-data-jpa includes it, along with Spring Data JPA, Spring ORM and HikariCP, and the Spring Boot dependency management picks a compatible Hibernate version. Overriding that version is possible but risky, because Spring Data and Spring ORM are tested against the version Boot manages. Configure behaviour through spring.jpa.* and spring.jpa.properties.hibernate.* properties.
ClassNotFoundException: javax.persistence... means a 5.x library is mixed with 6.x or later; use Jakarta imports everywhere.Unable to determine Dialect means the JDBC URL is missing, or no driver is on the classpath.NoSuchMethodError. Check with mvn dependency:tree.hibernate-core the same as hibernate-entitymanager?Almost. hibernate-entitymanager was the separate JPA module in Hibernate 5. It was merged into hibernate-core in Hibernate 5.2, and later versions have no such artifact.
hibernate-core if I use Spring Data JPA?Yes, but you get it automatically from spring-boot-starter-data-jpa. Spring Data JPA is only a layer on top of a JPA provider, and Hibernate is the default.
Use org.hibernate.orm for Hibernate 6 and later, and org.hibernate only for the 5.x line.
Yes, through the native SessionFactory and Session API, which are in hibernate-core.
hibernate-core is the central Hibernate ORM library: mapping, sessions, queries and the JPA implementation. Use the org.hibernate.orm group for current releases, add a JDBC driver and a connection pool, and let Spring Boot manage the version when you use spring-boot-starter-data-jpa.