Repository: mongodb/mongo-hibernate
Pull request #57: minor improvements
Author: login: NathanQingyangXu
Created: 2025-02-28T20:42:16Z | Merged: 2025-03-04T16:36:22Z

1. add missing `final` keyword usge in `AstParameterMarker.INSTANCE` constant field
2. use `assertThat` to verify various JDBC closed testing message verification
3. change `MongoConnection`'s close error message to maintain consistency
4. update outdated Javadocs
5. rename `BasicCrudTests` to `BasicCrudIntegrationTests`
6. delete `mongodb_extension.png` from README.md


Diff:
diff --git a/README.md b/README.md
index 93f4d7c9..3d7ba20b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# MongoDB extension of Hibernate ORM
+# MongoDB Extension of Hibernate ORM
 
 This product enables applications to use databases managed by the [MongoDB](https://www.mongodb.com/) DBMS
 via [Hibernate ORM](https://hibernate.org/orm/).
@@ -12,8 +12,6 @@ MongoDB speaks MQL (**M**ongoDB **Q**uery **L**anguage) instead of SQL. This pro
 - Translating Hibernate's internal SQL AST into MQL by means of a custom [`Dialect`](https://docs.jboss.org/hibernate/orm/6.6/javadocs/org/hibernate/dialect/Dialect.html),
   which has to be plugged into Hibernate ORM.
 
-<img src="mongodb_extension.png" alt="MongoDB extension" />
-
 ## Development
 
 Java 17 is the JDK version for development.
diff --git a/mongodb_extension.png b/mongodb_extension.png
deleted file mode 100644
index f712117d..00000000
Binary files a/mongodb_extension.png and /dev/null differ
diff --git a/src/integrationTest/java/com/mongodb/hibernate/BasicCrudTests.java b/src/integrationTest/java/com/mongodb/hibernate/BasicCrudIntegrationTests.java
similarity index 96%
rename from src/integrationTest/java/com/mongodb/hibernate/BasicCrudTests.java
rename to src/integrationTest/java/com/mongodb/hibernate/BasicCrudIntegrationTests.java
index ca39dd2c..14128fd3 100644
--- a/src/integrationTest/java/com/mongodb/hibernate/BasicCrudTests.java
+++ b/src/integrationTest/java/com/mongodb/hibernate/BasicCrudIntegrationTests.java
@@ -43,8 +43,10 @@
 import org.junit.jupiter.api.Test;
 
 @SessionFactory(exportSchema = false)
-@DomainModel(annotatedClasses = {BasicCrudTests.Book.class, BasicCrudTests.BookWithEmbeddedField.class})
-class BasicCrudTests implements SessionFactoryScopeAware {
+@DomainModel(
+        annotatedClasses = {BasicCrudIntegrationTests.Book.class, BasicCrudIntegrationTests.BookWithEmbeddedField.class
+        })
+class BasicCrudIntegrationTests implements SessionFactoryScopeAware {
 
     @AutoClose
     private MongoClient mongoClient;
@@ -147,7 +149,6 @@ class DeleteTests {
         @Test
         void testSimpleDeletion() {
 
-            // given
             var id = 1;
             sessionFactoryScope.inTransaction(session -> {
                 var book = new Book();
@@ -159,13 +160,11 @@ void testSimpleDeletion() {
             });
             assertThat(getCollectionDocuments()).hasSize(1);
 
-            // when
             sessionFactoryScope.inTransaction(session -> {
                 var book = session.getReference(Book.class, id);
                 session.remove(book);
             });
 
-            // then
             assertThat(getCollectionDocuments()).isEmpty();
         }
     }
diff --git a/src/main/java/com/mongodb/hibernate/internal/translate/mongoast/AstParameterMarker.java b/src/main/java/com/mongodb/hibernate/internal/translate/mongoast/AstParameterMarker.java
index 5f483dc0..5fe23382 100644
--- a/src/main/java/com/mongodb/hibernate/internal/translate/mongoast/AstParameterMarker.java
+++ b/src/main/java/com/mongodb/hibernate/internal/translate/mongoast/AstParameterMarker.java
@@ -20,7 +20,7 @@
 
 public final class AstParameterMarker implements AstValue {
 
-    public static AstParameterMarker INSTANCE = new AstParameterMarker();
+    public static final AstParameterMarker INSTANCE = new AstParameterMarker();
 
     private AstParameterMarker() {}
 
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/ConnectionAdapter.java b/src/main/java/com/mongodb/hibernate/jdbc/ConnectionAdapter.java
index f351102c..be52fcdd 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/ConnectionAdapter.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/ConnectionAdapter.java
@@ -38,11 +38,6 @@
 import java.util.concurrent.Executor;
 import org.jspecify.annotations.Nullable;
 
-/**
- * A {@link java.sql.Connection} adapter interface that throws exceptions for all its API methods.
- *
- * @see MongoConnection
- */
 interface ConnectionAdapter extends Connection {
 
     @Override
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/DatabaseMetaDataAdapter.java b/src/main/java/com/mongodb/hibernate/jdbc/DatabaseMetaDataAdapter.java
index 9a5ac0a3..192f9702 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/DatabaseMetaDataAdapter.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/DatabaseMetaDataAdapter.java
@@ -23,11 +23,6 @@
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 
-/**
- * A {@link java.sql.DatabaseMetaData} adapter interface that throws exceptions for all its API methods.
- *
- * @see MongoDatabaseMetaData
- */
 interface DatabaseMetaDataAdapter extends DatabaseMetaData {
 
     @Override
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
index aedfe841..0cd77191 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
@@ -36,12 +36,6 @@
 import org.bson.BsonInt32;
 import org.jspecify.annotations.Nullable;
 
-/**
- * MongoDB Dialect's JDBC {@linkplain java.sql.Connection connection} implementation class.
- *
- * <p>It only focuses on API methods Mongo Dialect will support. All the other methods are implemented by throwing
- * exceptions in its parent {@linkplain ConnectionAdapter adapter interface}.
- */
 final class MongoConnection implements ConnectionAdapter {
 
     private final MongoClient mongoClient;
@@ -237,7 +231,7 @@ public boolean isWrapperFor(Class<?> iface) throws SQLException {
 
     private void checkClosed() throws SQLException {
         if (closed) {
-            throw new SQLException("Connection has been closed");
+            throw new SQLException(format("%s has been closed", getClass().getSimpleName()));
         }
     }
 }
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java
index 47d55d80..c519ef5c 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java
@@ -24,7 +24,6 @@
 import com.mongodb.client.MongoClient;
 import com.mongodb.client.MongoClients;
 import com.mongodb.hibernate.BuildConfig;
-import com.mongodb.hibernate.dialect.MongoDialect;
 import com.mongodb.hibernate.internal.VisibleForTesting;
 import com.mongodb.hibernate.internal.service.StandardServiceRegistryScopedState;
 import java.io.IOException;
@@ -42,7 +41,7 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * {@linkplain MongoDialect MongoDB dialect}'s customized JDBC {@link ConnectionProvider} SPI implementation.
+ * A {@link ConnectionProvider} for the MongoDB extension of Hibernate ORM.
  *
  * <p>All the work done via a {@link Connection} {@linkplain MongoConnectionProvider#getConnection() obtained} from this
  * {@linkplain ConnectionProvider} is done within the same {@link ClientSession}.
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoDatabaseMetaData.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoDatabaseMetaData.java
index c503e665..c33f3275 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/MongoDatabaseMetaData.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoDatabaseMetaData.java
@@ -25,12 +25,6 @@
 import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 
-/**
- * MongoDB Dialect's JDBC {@link java.sql.DatabaseMetaData} implementation class.
- *
- * <p>It only focuses on API methods MongoDB Dialect will support. All the other methods are implemented by throwing
- * exceptions in its parent {@link DatabaseMetaDataAdapter adapter interface}.
- */
 final class MongoDatabaseMetaData implements DatabaseMetaDataAdapter {
 
     public static final String MONGO_DATABASE_PRODUCT_NAME = "MongoDB";
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoPreparedStatement.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoPreparedStatement.java
index 7676b950..3f0cd011 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/MongoPreparedStatement.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoPreparedStatement.java
@@ -52,12 +52,6 @@
 import org.bson.BsonValue;
 import org.bson.types.Decimal128;
 
-/**
- * MongoDB Dialect's JDBC {@link java.sql.PreparedStatement} implementation class.
- *
- * <p>It only focuses on API methods MongoDB Dialect will support. All the other methods are implemented by throwing
- * exceptions in its parent {@link PreparedStatementAdapter adapter interface}.
- */
 final class MongoPreparedStatement extends MongoStatement implements PreparedStatementAdapter {
 
     private final BsonDocument command;
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
index 03d7397c..dccab977 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
@@ -31,12 +31,6 @@
 import org.bson.BsonDocument;
 import org.jspecify.annotations.Nullable;
 
-/**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
- *
- * <p>It only focuses on API methods Mongo Dialect will support. All the other methods are implemented by throwing
- * exceptions in its parent {@link StatementAdapter adapter interface}.
- */
 class MongoStatement implements StatementAdapter {
 
     private final MongoDatabase mongoDatabase;
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/PreparedStatementAdapter.java b/src/main/java/com/mongodb/hibernate/jdbc/PreparedStatementAdapter.java
index fe1e08af..06f2bac9 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/PreparedStatementAdapter.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/PreparedStatementAdapter.java
@@ -39,11 +39,6 @@
 import java.util.Calendar;
 import org.jspecify.annotations.Nullable;
 
-/**
- * A {@link java.sql.PreparedStatement} adapter interface that throws exceptions for all its API methods.
- *
- * @see MongoPreparedStatement
- */
 interface PreparedStatementAdapter extends StatementAdapter, PreparedStatement {
     @Override
     default ResultSet executeQuery() throws SQLException {
diff --git a/src/main/java/com/mongodb/hibernate/jdbc/StatementAdapter.java b/src/main/java/com/mongodb/hibernate/jdbc/StatementAdapter.java
index f6759d06..ca5028e1 100644
--- a/src/main/java/com/mongodb/hibernate/jdbc/StatementAdapter.java
+++ b/src/main/java/com/mongodb/hibernate/jdbc/StatementAdapter.java
@@ -24,11 +24,6 @@
 import java.sql.Statement;
 import org.jspecify.annotations.Nullable;
 
-/**
- * A {@link java.sql.Statement} adapter interface that throws exceptions for all its API methods.
- *
- * @see MongoStatement
- */
 interface StatementAdapter extends Statement {
     @Override
     default ResultSet executeQuery(String sql) throws SQLException {
diff --git a/src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java b/src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java
index 0d90d40c..c45c3a6f 100644
--- a/src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java
+++ b/src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java
@@ -18,6 +18,7 @@
 
 import static com.mongodb.hibernate.jdbc.MongoDatabaseMetaData.MONGO_DATABASE_PRODUCT_NAME;
 import static com.mongodb.hibernate.jdbc.MongoDatabaseMetaData.MONGO_JDBC_DRIVER_NAME;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.hibernate.cfg.AvailableSettings.JAKARTA_JDBC_URL;
 import static org.junit.jupiter.api.Assertions.assertAll;
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -114,8 +115,8 @@ void testCheckClosed(String label, ConnectionMethodInvocation methodInvocation)
 
             mongoConnection.close();
 
-            var exception = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoConnection));
-            assertEquals("Connection has been closed", exception.getMessage());
+            var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoConnection));
+            assertThat(sqlException.getMessage()).matches("MongoConnection has been closed");
         }
 
         private static Stream<Arguments> getMongoConnectionMethodInvocationsImpactedByClosing() {
diff --git a/src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java b/src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java
index 5237a645..b1964d5c 100644
--- a/src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java
+++ b/src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java
@@ -17,9 +17,9 @@
 package com.mongodb.hibernate.jdbc;
 
 import static java.lang.String.format;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doReturn;
@@ -179,7 +179,7 @@ void testCheckClosed(String label, PreparedStatementMethodInvocation methodInvoc
             preparedStatement.close();
 
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertEquals("MongoPreparedStatement has been closed", sqlException.getMessage());
+            assertThat(sqlException.getMessage()).matches("MongoPreparedStatement has been closed");
         }
 
         private static Stream<Arguments> getMongoPreparedStatementMethodInvocationsImpactedByClosing() {
@@ -240,14 +240,14 @@ void beforeEach() throws SQLSyntaxErrorException {
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexUnderflow")
         void testParameterIndexUnderflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage()).startsWith("Parameter index invalid");
         }
 
         @ParameterizedTest(name = "SQLException is thrown when \"{0}\" is called with parameter index being too high")
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexOverflow")
         void testParameterIndexOverflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage()).startsWith("Parameter index invalid");
         }
 
         private static Stream<Arguments> getMongoPreparedStatementMethodInvocationsWithParameterIndexUnderflow() {
diff --git a/src/test/java/com/mongodb/hibernate/jdbc/MongoStatementTests.java b/src/test/java/com/mongodb/hibernate/jdbc/MongoStatementTests.java
index f06c74f7..554f7541 100644
--- a/src/test/java/com/mongodb/hibernate/jdbc/MongoStatementTests.java
+++ b/src/test/java/com/mongodb/hibernate/jdbc/MongoStatementTests.java
@@ -16,6 +16,7 @@
 
 package com.mongodb.hibernate.jdbc;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -114,8 +115,8 @@ interface StatementMethodInvocation {
         void testCheckClosed(String label, StatementMethodInvocation methodInvocation) {
             mongoStatement.close();
 
-            var exception = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoStatement));
-            assertEquals("MongoStatement has been closed", exception.getMessage());
+            var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoStatement));
+            assertThat(sqlException.getMessage()).matches("MongoStatement has been closed");
         }
 
         private static Stream<Arguments> getMongoStatementMethodInvocationsImpactedByClosing() {


Reviews:
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-28T20:42:49Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-28T20:43:24Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-28T20:52:04Z
user: login: stIncMale
body: Thank you, very nice catches!
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-02-28T23:07:11Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-02T14:09:05Z
user: login: stIncMale
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-02T15:54:41Z
user: login: stIncMale
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-02T15:54:48Z
user: login: stIncMale
body: The last reviewed commit is f553f102e02260af39bf22a13e6d305df5470363.
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-02T15:55:31Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T10:07:49Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T10:08:12Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-03T13:44:00Z
user: login: stIncMale
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T22:48:12Z
user: login: stIncMale
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T22:52:06Z
user: login: stIncMale
body: The last reviewed commit is 56ee13b5be739181ddb9d535ff5f8d7a711398b8.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-03T22:59:02Z
user: login: NathanQingyangXu
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T02:23:03Z
user: login: stIncMale
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-04T16:05:37Z

Review comments:
diff_hunk: @@ -237,7 +237,7 @@ public boolean isWrapperFor(Class<?> iface) throws SQLException {
 
     private void checkClosed() throws SQLException {
         if (closed) {
-            throw new SQLException("Connection has been closed");
+            throw new SQLException("MongoConnection has been closed");
path: src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
user: login: NathanQingyangXu
body: all other JDBC classes are using native class name, except this one
created_at: 2025-02-28T20:42:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -114,8 +115,8 @@ void testCheckClosed(String label, ConnectionMethodInvocation methodInvocation)
 
             mongoConnection.close();
 
-            var exception = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoConnection));
-            assertEquals("Connection has been closed", exception.getMessage());
+            var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(mongoConnection));
+            assertThat(sqlException.getMessage()).matches("MongoConnection has been closed");
path: src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java
user: login: NathanQingyangXu
body: maintain consistency with similar usage piorneered by @stIncMale 
created_at: 2025-02-28T20:43:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,4 +1,4 @@
-# MongoDB extension of Hibernate ORM
+# MongoDB Extension of Hibernate ORM
path: README.md
user: login: NathanQingyangXu
body: Uppercase is used in highest level header
created_at: 2025-02-28T20:52:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -240,14 +240,16 @@ void beforeEach() throws SQLSyntaxErrorException {
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexUnderflow")
         void testParameterIndexUnderflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage())
+                    .matches("Parameter index invalid: \\d+; should be within \\[1, \\d+]");
         }
 
         @ParameterizedTest(name = "SQLException is thrown when \"{0}\" is called with parameter index being too high")
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexOverflow")
         void testParameterIndexOverflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage())
+                    .matches("Parameter index invalid: \\d+; should be within \\[1, \\d+]");
path: src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java
user: login: stIncMale
body: This is overfitting which I don't see any reason for. All we need to check here is that the exception thrown is related to the index being incorrect, these tests are not here to enforce the exception message. Do you think we could undo this change?
created_at: 2025-02-28T21:47:01Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
  *
- * <p>It only focuses on API methods Mongo Dialect will support. All the other methods are implemented by throwing
+ * <p>It only focuses on API methods Mongo extension will support. All the other methods are implemented by throwing
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: 1. Here the wording does not prevent us from using the full name of the product: "MongoDB extension of Hibernate ORM"
2. Let's use present simple instead of future simple when documenting something.

I propose us to do the same change in `MongoPreparedStatement.java`, `MongoDatabaseMetaData.java`, `MongoConnection.java`.


```suggestion
 * <p>It only focuses on API methods MongoDB extension of Hibernate ORM supports. All the other methods are implemented by throwing
```
created_at: 2025-02-28T22:11:40Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: There is no need to duplicate the information that `java.sql.Statement` we link to is part of the JDBC API, as the API we link to describes itself as such.

I propose to do the same change in `MongoPreparedStatement.java`, `MongoDatabaseMetaData.java`, `MongoConnection.java`, `MongoConnectionProvider.java`. In the latter, saying "JDBC `ConnectionProvider`" is not even correct, as `ConnectionProvider` is not part of the JDBC API.

```suggestion
 * MongoDB extension's {@link java.sql.Statement} implementation class.
```
created_at: 2025-02-28T22:16:44Z
author_association: MEMBER
diff_hunk: @@ -42,7 +41,7 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * {@linkplain MongoDialect MongoDB dialect}'s customized JDBC {@link ConnectionProvider} SPI implementation.
+ * Mongo extension's customized JDBC {@link ConnectionProvider} SPI implementation.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java
user: login: stIncMale
body: Let's remove the "SPI implementation" part. `Dialect` is not any less SPI than `ConnectionProvider`, though Hibernate ORM did not correctly put it in an `spi` package, and we don't mention SPI in the documentation of `MongoDialect`.

```suggestion
 * Mongo extension's customized JDBC {@link ConnectionProvider}.
```
created_at: 2025-02-28T22:22:57Z
author_association: MEMBER
diff_hunk: @@ -237,7 +237,7 @@ public boolean isWrapperFor(Class<?> iface) throws SQLException {
 
     private void checkClosed() throws SQLException {
         if (closed) {
-            throw new SQLException("Connection has been closed");
+            throw new SQLException("MongoConnection has been closed");
path: src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
user: login: stIncMale
body: I see the above line and `throw new SQLException(format("%s has been closed", getClass().getSimpleName()))` in `MongoStatement`. There are no other lines with "has been closed". Let's similarly change the above line to `throw new SQLException(format("%s has been closed", getClass().getSimpleName()))`?
created_at: 2025-02-28T23:05:42Z
author_association: MEMBER
diff_hunk: @@ -240,14 +240,16 @@ void beforeEach() throws SQLSyntaxErrorException {
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexUnderflow")
         void testParameterIndexUnderflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage())
+                    .matches("Parameter index invalid: \\d+; should be within \\[1, \\d+]");
         }
 
         @ParameterizedTest(name = "SQLException is thrown when \"{0}\" is called with parameter index being too high")
         @MethodSource("getMongoPreparedStatementMethodInvocationsWithParameterIndexOverflow")
         void testParameterIndexOverflow(String label, PreparedStatementMethodInvocation methodInvocation) {
             var sqlException = assertThrows(SQLException.class, () -> methodInvocation.runOn(preparedStatement));
-            assertTrue(sqlException.getMessage().startsWith("Parameter index invalid"));
+            assertThat(sqlException.getMessage())
+                    .matches("Parameter index invalid: \\d+; should be within \\[1, \\d+]");
path: src/test/java/com/mongodb/hibernate/jdbc/MongoPreparedStatementTests.java
user: login: NathanQingyangXu
body: you are right. I changed to use `assertThat(...).startsWith("Parameter index invalid")` then
created_at: 2025-03-02T14:09:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: This discussion was marked as resolved, but it wasn't fully addressed.
created_at: 2025-03-02T15:54:41Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
  *
- * <p>It only focuses on API methods Mongo Dialect will support. All the other methods are implemented by throwing
+ * <p>It only focuses on API methods Mongo extension will support. All the other methods are implemented by throwing
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: This discussion was marked as resolved, but it wasn't fully addressed.
created_at: 2025-03-02T15:54:48Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: NathanQingyangXu
body: Sorry I missed something. Updated. Let me know whether the changes are complete.
created_at: 2025-03-03T10:07:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
  *
- * <p>It only focuses on API methods Mongo Dialect will support. All the other methods are implemented by throwing
+ * <p>It only focuses on API methods Mongo extension will support. All the other methods are implemented by throwing
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: NathanQingyangXu
body: updated
created_at: 2025-03-03T10:08:12Z
author_association: CONTRIBUTOR
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: NathanQingyangXu
body: If we enabled "short-name" strategy and thus move `jdbc` stuff into `internal` package, we might well leave out such Javadoc maintaining burden as one benefit.
created_at: 2025-03-03T13:44:00Z
author_association: CONTRIBUTOR
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: If you would like to remove the documentation from `MongoStatement`, `MongoPreparedStatement`, `MongoDatabaseMetaData`, `MongoConnection` - I am all for that. They should stay in the `jdbc` package. But they are already not part of the API because they are package-access, so we can safely remove their docs.
created_at: 2025-03-03T22:48:12Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: stIncMale
body: If we do remove those docs, then only `MongoConnectionProvider` will stay documented, as it is part of the API. And maybe we could use

> A {@link ConnectionProvider} for the MongoDB extension of Hibernate ORM.

instead of the current

> MongoDB extension's customized {@link ConnectionProvider}.

Because that way we'll be able to use the full product name "MongoDB extension of Hibernate ORM" in the doc, instead of just "MongoDB extension".
created_at: 2025-03-03T22:52:06Z
author_association: MEMBER
diff_hunk: @@ -32,9 +32,9 @@
 import org.jspecify.annotations.Nullable;
 
 /**
- * MongoDB Dialect's JDBC {@link java.sql.Statement} implementation class.
+ * MongoDB extension's JDBC {@link java.sql.Statement} implementation class.
path: src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
user: login: NathanQingyangXu
body: removed the javadocs except `MongoConnectionProvider` with changes you suggested.
created_at: 2025-03-04T02:23:03Z
author_association: CONTRIBUTOR

PR comments:
user: login: NathanQingyangXu
created_at: 2025-03-02T14:09:53Z
body: > I see the above line and throw new SQLException(format("%s has been closed", getClass().getSimpleName())) in MongoStatement. There are no other lines with "has been closed". Let's similarly change the above line to throw new SQLException(format("%s has been closed", getClass().getSimpleName()))?

Good point. I did that for consistency
author_association: CONTRIBUTOR
user: login: NathanQingyangXu
created_at: 2025-03-02T14:18:15Z
body: I also delete the dubious `mongodb_extension.png` from README.md, which was introduced with same rationale of those convoluted JDBC patterns to prepare for community contribution. But given the project is to be maintained mainly by Java driver team members, that is over-engineering so for now I decided to remove it.
author_association: CONTRIBUTOR
user: login: stIncMale
created_at: 2025-03-04T16:09:53Z
body: The last reviewed commit is 9b6003f47f6e36ced03134e8094ab0d45f0eb241.
author_association: MEMBER