Skip to content

MongoDB extension of Hibernate ORM

License

Notifications You must be signed in to change notification settings

mongodb/mongo-hibernate

Repository files navigation

MongoDB extension of Hibernate ORM

This product enables applications to use databases managed by the MongoDB DBMS via Hibernate ORM.

Overview

MongoDB speaks MQL (MongoDB Query Language) instead of SQL. This product works by:

  • Creating a JDBC adapter using MongoDB Java Driver, which has to be plugged into Hibernate ORM via a custom ConnectionProvider.
  • Translating Hibernate's internal SQL AST into MQL by means of a custom Dialect, which has to be plugged into Hibernate ORM.

MongoDB extension

Development

Java 17 is the JDK version for development.

Initially Hibernate ORM v6.6 is the dependency version.

MongoDB v6.0 is the minimal version this product supports.

Standalone instance is not supported. It is recommended to convert it to a replica set.

Build from Source

Static Code Analysis

Code Style Check

We chose Spotless as a general-purpose formatting plugin, and Palantir Java Format as a Java-specific formatting tool integrated with it.

To check whether any format violation exists, run spotlessCheck gradle task. If any format violation is found during the previous step, run spotlessApply auto-formatting task to fix it automatically.

Code Quality Check

Error Prone gradle plugin is chosen for Java code qualify analysis during Java compiling phrase. NullAway is a Java NullPointerExceptions (NPEs) prevention gradle plugin integrated with Error Prone. JSpecify annotations are used to help NullAway detect potential NPEs.

Both plugins are enabled on gradle's compileJava task.

Testing

This project uses separate directories for unit and integration tests:

Gradle Tasks

Unit Test
./gradlew clean test
Integration Test
./gradlew clean integrationTest

Integration tests require a MongoDB deployment. You may change the default MongoDB connection string as below, in hibernate.properties:

jakarta.persistence.jdbc.url={your_mongodb_connection_string}

CI/CD

This project uses evergreen, a distributed continuous integration system from MongoDB. The evergreen configuration is in the .evergreen directory.

References

About

MongoDB extension of Hibernate ORM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •