Skip to content

Commit cccc434

Browse files
authored
1 parent d162cee commit cccc434

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.bson.BsonDocument;
3434
import org.bson.BsonInt32;
3535
import org.jspecify.annotations.Nullable;
36-
import org.slf4j.Logger;
37-
import org.slf4j.LoggerFactory;
3836

3937
/**
4038
* MongoDB Dialect's JDBC {@linkplain java.sql.Connection connection} implementation class.
@@ -44,8 +42,6 @@
4442
*/
4543
final class MongoConnection implements ConnectionAdapter {
4644

47-
private final Logger logger = LoggerFactory.getLogger(MongoConnection.class);
48-
4945
// TODO-HIBERNATE-38 temporary hard-coded database prior to the db config tech design finalizing
5046
public static final String DATABASE = "mongo-hibernate-test";
5147

@@ -193,11 +189,11 @@ public DatabaseMetaData getMetaData() throws SQLException {
193189
return new MongoDatabaseMetaData(
194190
this, versionText, versionArray.get(0), versionArray.get(1), assertNotNull(BuildConfig.VERSION));
195191
} 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);
201197
}
202198
}
203199

0 commit comments

Comments
 (0)