BlogInnovate for the AI Era: Get the latest MongoDB.local NYC 2025 news and updates! Read the blog >
NewModernize 2-3x faster with MongoDB’s AI-powered Application Modernization Platform. Learn more >
NewSearch & Vector Search now in public preview for Community Edition Read the blog >
Blog home
arrow-left

Introducing the MongoDB Extension for Hibernate ORM in Public Preview

November 4, 2025 ・ 3 min read

We are excited to announce that the MongoDB Extension for Hibernate, an object-relational mapping (ORM) framework for Java, is now available in public preview. This extension provides Java developers with the freedom and flexibility to build modern applications using MongoDB’s document model and Hibernate’s user-friendly features, including Java Persistence API (JPA) annotations, Hibernate Query Language (HQL) support, Criteria Queries, and caching.

Key features of the MongoDB Extension for Hibernate

Now, Java developers using Hibernate have the best of both worlds: they can use familiar Hibernate paradigms for entity operations, queries, and more, while enjoying the flexibility to evolve their schema over time that comes with building on MongoDB.

The extension supports the following key features:

  • Native embedded documents for faster reads: Nest objects and collections inside each document for higher read performance and more intuitive data hierarchy.
  • Familiar JPA annotations: Use the same annotations and patterns you already know, bridging the document model with standard JPA semantics.
  • Query using Hibernate’s query languages and MongoDB’s Query API: Write queries in HQL/JPQL while also using native MongoDB Query API for more advanced operations such as multi-collection joins and vector search queries.

A full list of features in this public preview is available through our docs.

Why build your Java applications with MongoDB and Hibernate?

As an ORM framework for Java, Hibernate was created to map object-oriented Java code to work with the constraints of relational databases. This allowed Java developers to focus more on writing code and less on the tedious and often error-prone process of translating their Java objects for relational persistence.

However, while Java developers building with Hibernate can get a more intuitive experience when working with relational databases, using Hibernate cannot eliminate the core constraints of relational data models, including the difficulty of evolving schemas and handling different data types. As modern applications evolve, they demand support for changing data structures, which can be difficult to implement in relational databases. When developers need to modify the schema (like adding a new column to a table or introducing a new relationship), they must perform a schema migration. This requires careful consideration of data dependencies (like foreign keys), default values for existing rows (or NULL values), and the performance impact of altering large tables.

With the MongoDB Extension for Hibernate, Java developers using Hibernate are no longer restricted to using relational databases. They can build with MongoDB and utilize familiar Hibernate annotations, such as @Entity and @Id, along with Session.persist() or HQL queries, to create modern applications.

MongoDB provides developers with the flexibility they need through its document model, while still allowing them to exert control over schema where necessary. For example, Java developers can design suitable data models for their applications and easily add new fields or make other changes to their data schema. Developers don’t need to pre-define a rigid structure of rows and columns when modeling data with MongoDB. They can then enforce the schema using MongoDB’s built-in schema validation.

Moreover, MongoDB also makes it easier to store and manage various types of data—from simple text and numbers to complex embedded documents and arrays—all within a single database.

This flexibility, combined with powerful native features for use cases like vector search (MongoDB Atlas Vector Search), data analysis (using the Aggregation Framework), real-time data stream processing (Atlas Stream Processing), graph relationships, and geospatial data handling, makes MongoDB an excellent choice for building modern Java applications with Hibernate.

Under the hood: How the Extension talks to MongoDB

To explain how this extension works, let’s look at a code example:

With the new MongoDB Extension, Hibernate can map your entities to MongoDB collections and automatically transform common operations, such as persist, find, and HQL queries, into MongoDB commands. For instance, consider a straightforward HQL query like:

Unformatted

The MongoDB dialect translates the query into an equivalent MongoDB aggregation pipeline, such as:

Unformatted

This translation occurs transparently; developers continue to use Hibernate’s familiar API while the framework generates the corresponding MongoDB Query API commands under the hood.

Getting started with the MongoDB Extension for Hibernate

The integration is straightforward—simply add the extension to your project's build setup and configure Hibernate to use it. Follow this getting-started guide for a step-by-step walkthrough.

For more technical information about this extension, please refer to our documentation.

Providing feedback

We would love to hear your feedback! You can suggest new features or vote on existing ideas at the MongoDB Feedback Portal. Your input is critical for shaping the future of this product. To provide more comprehensive feedback, users can contact their MongoDB account team.