Skip to content

Conversation

@NathanQingyangXu
Copy link
Contributor

@NathanQingyangXu NathanQingyangXu commented Dec 6, 2024

https://jira.mongodb.org/browse/HIBERNATE-37

Most of the java.sql.DatabaseMetaData used by Hibernate is irrelevant to Mongo Dialect (vast majority is for DDL processing, which has no counterpart in Mongo Dialect; the only DDL in Mongo Dialect is for index and unique constraint creation in the last milestone), except for the following items:

  • mongodb version (if below 6.0, MongoDialect will complain by throwing exception)
  • boolean supportsBatchUpdates(), which is vital to MongoDB Dialect

The mongoDB version might be used for future version-specific feature exploitation (e.g. new bulk write feature introduced since v8).

The current implementation is based on running buildinfo command to admin database.

Finally we could get rid of the deprecated default constructor of MongoDialect.

@NathanQingyangXu NathanQingyangXu force-pushed the HIBERNATE-37-metadata branch 4 times, most recently from 15c948c to aa09c03 Compare December 19, 2024 15:08
@NathanQingyangXu NathanQingyangXu force-pushed the HIBERNATE-37-metadata branch 2 times, most recently from 515e261 to 5d3a0dd Compare January 16, 2025 15:53
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reviewed commit is c5f397f. I did not review ResultSetAdapter, as I am not yet sure if it's actually needed in this PR.

…ticket (which will enlarge scope to provide the Driver versions)
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reviewed commit is d3cc51d.

jyemin
jyemin previously approved these changes Jan 24, 2025
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't plan to review this further so LGTM-ing to allow merge when Valentin approves.

# Conflicts:
#	src/test/java/com/mongodb/hibernate/jdbc/MongoClientCustomizerTests.java
# Conflicts:
#	src/main/java/com/mongodb/hibernate/jdbc/MongoConnection.java
#	src/main/java/com/mongodb/hibernate/jdbc/MongoStatement.java
#	src/test/java/com/mongodb/hibernate/jdbc/MongoConnectionTests.java
Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reviewed commit is a3ae083.

jakarta.persistence.jdbc.url=mongodb://localhost/mongo-hibernate-test?directConnection=false
hibernate.dialect=com.mongodb.hibernate.dialect.MongoDialect
hibernate.connection.provider_class=com.mongodb.hibernate.jdbc.MongoConnectionProvider
hibernate.boot.allow_jdbc_metadata_access=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This way all unit tests will avoid trying to load the metadata. This is better than having to specify JdbcSettings.ALLOW_METADATA_ON_BOOT for each of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, separating unit and integration testings make lots of sense for they have different requirements and specialities. In the future we might introduce Hibernate's integration testing library (hibernate-testing) which only makes sense in integration testing context.

Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reviewed commit is b229a4d.

Copy link
Member

@stIncMale stIncMale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reviewed commit is e74ee15.

@NathanQingyangXu NathanQingyangXu merged commit 6ec0093 into mongodb:main Jan 28, 2025
6 checks passed
@NathanQingyangXu NathanQingyangXu deleted the HIBERNATE-37-metadata branch January 28, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants