|
33 | 33 | import org.bson.BsonDocument;
|
34 | 34 | import org.bson.BsonInt32;
|
35 | 35 | import org.jspecify.annotations.Nullable;
|
36 |
| -import org.slf4j.Logger; |
37 |
| -import org.slf4j.LoggerFactory; |
38 | 36 |
|
39 | 37 | /**
|
40 | 38 | * MongoDB Dialect's JDBC {@linkplain java.sql.Connection connection} implementation class.
|
|
44 | 42 | */
|
45 | 43 | final class MongoConnection implements ConnectionAdapter {
|
46 | 44 |
|
47 |
| - private final Logger logger = LoggerFactory.getLogger(MongoConnection.class); |
48 |
| - |
49 | 45 | // TODO-HIBERNATE-38 temporary hard-coded database prior to the db config tech design finalizing
|
50 | 46 | public static final String DATABASE = "mongo-hibernate-test";
|
51 | 47 |
|
@@ -193,11 +189,11 @@ public DatabaseMetaData getMetaData() throws SQLException {
|
193 | 189 | return new MongoDatabaseMetaData(
|
194 | 190 | this, versionText, versionArray.get(0), versionArray.get(1), assertNotNull(BuildConfig.VERSION));
|
195 | 191 | } catch (RuntimeException e) {
|
196 |
| - var msg = "Failed to get metadata"; |
197 |
| - if (logger.isErrorEnabled()) { |
198 |
| - logger.error(msg, e); |
199 |
| - } |
200 |
| - throw new SQLException(msg, e); |
| 192 | + // TODO-HIBERNATE-43 Let's do `LOGGER.error(<message>, e)`. |
| 193 | + // Hibernate ORM neither propagates, nor logs `e` (the cause of the `SQLException` we throw), |
| 194 | + // so if we fail to get `DatabaseMetaData` due to being unable to connect to a MongoDB deployment, |
| 195 | + // there is no easy way to know that. |
| 196 | + throw new SQLException("Failed to get metadata", e); |
201 | 197 | }
|
202 | 198 | }
|
203 | 199 |
|
|
0 commit comments