From 59990334ee42619ec247a8ad306658edaf348db4 Mon Sep 17 00:00:00 2001 From: Nathan Xu Date: Fri, 8 Nov 2024 21:38:44 -0500 Subject: [PATCH] update MongoConnectionProvider as per code review comments --- .../jdbc/MongoConnectionProvider.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java index 90b9c5dc..cff93c51 100644 --- a/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java +++ b/src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java @@ -16,7 +16,9 @@ package com.mongodb.hibernate.jdbc; -import static org.hibernate.cfg.JdbcSettings.*; +import static org.hibernate.cfg.JdbcSettings.JAKARTA_JDBC_PASSWORD; +import static org.hibernate.cfg.JdbcSettings.JAKARTA_JDBC_URL; +import static org.hibernate.cfg.JdbcSettings.JAKARTA_JDBC_USER; import com.mongodb.ConnectionString; import com.mongodb.MongoClientSettings; @@ -42,15 +44,35 @@ *

{@link MongoConnectionProvider} uses the following Hibernate properties: * *

* - *

{@value org.hibernate.cfg.JdbcSettings#JAKARTA_JDBC_URL} property is mandatory and it maps to MongoDB's {@value JdbcSettings#JAKARTA_JDBC_URL} property is mandatory and it maps to MongoDB's connection string, in which database name * must be provided to align with JDBC URL's convention. The other two JDBC properties are optional. * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyDescriptionRequired
{@linkplain JdbcSettings#JAKARTA_JDBC_URL jakarta.persistence.jdbc.url}MongoDB + * connection string
{@linkplain JdbcSettings#JAKARTA_JDBC_USER jakarta.persistence.jdbc.user}{@code userName} for {@link com.mongodb.MongoCredential#createCredential(String, String, char[])}
{@linkplain JdbcSettings#JAKARTA_JDBC_PASSWORD jakarta.persistence.jdbc.password}{@code password} for {@link com.mongodb.MongoCredential#createCredential(String, String, char[])}
+ * * @see ConnectionProvider * @see JdbcSettings#JAKARTA_JDBC_URL * @see JdbcSettings#JAKARTA_JDBC_USER