This product enables applications to use databases managed by the MongoDB DBMS via Hibernate ORM.
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 standalone deployments are not supported, because they do not support transactions. If you use one, you may convert it to a replica set.
The groupId:artifactId coordinates: org.mongodb:mongodb-hibernate.
Maven is used as a build tool.
The Java module with example applications is located in
The examples may be run by running the smoke tests as specified in Run Smoke Tests.
Use "Extension for Hibernate ORM" at jira.mongodb.org.
Use "Drivers & Frameworks"/"Frameworks (e.g. Django, Hibernate, EFCore)" at feedback.mongodb.com.
Gradle is used as a build tool.
./gradlew buildSpotless Gradle plugin is used as a general-purpose formatting tool, Palantir Java Format is used as a Java-specific formatting tool integrated with it.
./gradlew spotlessCheck./gradlew spotlessApplyError Prone Gradle plugin
is used as a Java-specific code analysis tool,
NullAway is used as a
NullPointerException
prevention tool integrated with it. JSpecify annotations are used to specify nullness.
The analysis is done as part of the Gradle compileJava task execution.
This project uses separate directories for unit, integration, smoke tests:
./gradlew testThe integration tests require a MongoDB deployment that
- is accessible at
localhost:27017;- You may change the MongoDB connection string
via the
jakarta.persistence.jdbc.urlconfiguration property in./src/integrationTest/resources/hibernate.properties.
- You may change the MongoDB connection string
via the
- has test commands enabled.
- This may be achieved with the
--setParameter enableTestCommands=1command-line arguments.
- This may be achieved with the
./gradlew integrationTestThe smoke tests with the Tests suffix do not require a MongoDB deployment.
The smoke tests with the IntegrationTests suffix, as well as the examples, require a MongoDB deployment that
- is accessible at
localhost:27017.- You may change this by modifying the examples run by the smoke tests.
source ./.evergreen/java-config.sh \
&& ./gradlew -PjavaVersion=${JAVA_VERSION} publishToMavenLocal \
&& ./example-module/mvnw verify --file ./example-module/pom.xml \
-DjavaVersion="${JAVA_VERSION}" \
-DprojectVersion="$(./gradlew -q printProjectVersion)"Evergreen and GitHub Actions are used for continuous integration.