This project aims to provide a library to seamlessly integrate MongoDB with Hibernate ORM. Hibernate ORM is a powerful Object-relational mapping tool. Due to the SQL and JDBC standards, Hibernate ORM could centralize each SQL vendor's idiosyncrasies in the so-called Hibernate Dialect. This project will include a document database member in the Hibernate's Dialect family.
MongoDB speaks MQL (MongoDB Query Language in JSON format) instead of SQL. This project creates a MongoDB Hibernate Dialect by:
- Creating a JDBC adapter using MongoDB Java Driver
- Translating Hibernate's internal SQL AST into MQL
Java 17 is the JDK version for development.
Initially Hibernate ORM v6.6 is the dependency version.
MongoDB v6 is the minimal version this dialect supports.
Standalone instance is not supported. It is recommended to convert it to a replica set.
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.
Error Prone gradle plugin is chosen for Java code qualify analysis during Java compiling phrase. NullAway is a Java NullPointerException
s (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.