Skip to content

mongodb/mongo-hibernate

Repository files navigation

MongoDB Extension for Hibernate ORM

Java SE requirement Hibernate ORM requirement MongoDB DBMS requirement

Overview

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.

User Documentation

MongoDB standalone deployments are not supported, because they do not support transactions. If you use one, you may convert it to a replica set.

Maven Artifacts

The groupId:artifactId coordinates: org.mongodb:mongodb-hibernate.

Examples

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.

Bug Reports

Use "Extension for Hibernate ORM" at jira.mongodb.org.

Feature Requests

Use "Drivers & Frameworks"/"Frameworks (e.g. Django, Hibernate, EFCore)" at feedback.mongodb.com.

Contributor Documentation

Gradle is used as a build tool.

Build from Source

./gradlew build

Static Code Analysis

Code Formatting

Spotless Gradle plugin is used as a general-purpose formatting tool, Palantir Java Format is used as a Java-specific formatting tool integrated with it.

Check Code Formatting
./gradlew spotlessCheck
Format Code
./gradlew spotlessApply

Code Quality

Error 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.

Testing

This project uses separate directories for unit, integration, smoke tests:

Run Unit Tests

./gradlew test

Run Integration Tests

The integration tests require a MongoDB deployment that

./gradlew integrationTest

Run Smoke Tests

The 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)"

Continuous Integration

Evergreen and GitHub Actions are used for continuous integration.

About

An extension providing MongoDB support to Hibernate ORM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7