Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement ConnectionProvider #8
implement ConnectionProvider #8
Changes from 32 commits
da08c43
2c90afc
cdba9c5
ad28ab1
bb51724
5fb9c5e
08a9603
77b0a72
46e06e4
d68a0db
b816075
e151069
bbd90f8
4036693
9c9622c
a97f2dd
4f9f958
9b817a5
6ad89a0
cdf49b0
a73cf04
5c11f6c
e366ea6
452c559
2124619
196880e
8ac4c4f
8e5eb59
4756ea9
5a7ebed
51e3184
5307610
7d11aa1
8b3eefe
250673b
b7c37ca
089ba52
8e0d8e9
1af2884
8dd11e2
e831a88
b9c98ff
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of #8 (comment): let's not use
*
imports.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved. Palantir won't complain so I think it is minor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I learn about Palantir, the more inferior it seems to SpotBugs:
final
by default, for example;*
imports to be bad (they may cause unnecessary name conflicts, and much worse, they may result in new name conflicts when upgrading dependencies, even when no code changes were made).I wonder why was it chosen over SpotBugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't Palantir just a formatter, more akin to Checkstyle than SpotBugs?
ErrorProne is the thing that is closer to Spotbugs, and I believe it is extensible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am just judging based on what Nathan communicated at a catchup meeting: we can't configure the linter, at least, not nearly as flexibly as SpotBugs. If it is not Palantir but ErrorProne who does the checking, then my comment was about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite know much about linter so my remarks in the meeting might be wrong.
I think Palantir belongs to Spotless ecosystem. From its doc, since v7 (currently still in BETA), it does support something you desire: https://github.com/diffplug/spotless/tree/main/plugin-gradle#linting
Also, the decision to put
@Nullable
into the same line was from Spotless as well:https://github.com/diffplug/spotless/tree/main/plugin-gradle#formatannotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking more about this requirement, I don't think it is justified: we won't use the database name unless
JAKARTA_JDBC_USER
is also specified. Let's remove the requirement.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted, together with testing case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about this. In the POC,
MongoConnectionProvider
uses the database name to create aMongoDatabase
and passes it to theMongoConnection
constructor. ThisMongoDatabase
is used as a factory forMongoCollection
. e.g.Note that the collection name comes from the command created by the
MongoDialect
, and it does not include the database name. AFAIK there is no way for the dialect to know about the database name.But this might be an issue with trying to use
JAKARTA_JDBC_USER
, since there is no notion of an "auth source" like we have in MongoDB, where you can doAnd the
authSource
ofadmin
applies to the credential while the database name ofmydb
is only relevant to the application (in this case our dialect) but the driver ignores it otherwise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was discussing with @stIncMale about this. Seems we should retain the db verification logic for in most of cases, our local or evergreen testing simply requires a db, but no need to provide user or password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed on slack, we do need database name to kick of JDBC flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a choice but to do such mapping, because the whole idea of the project is to allow applications to use Hibernate ORM. That means, applications will still use Hibernate ORM API and properties, and Jakarta EE API. Those, in turn, are based on the JDBC API, which uses the "catalog" and "schema" terms. We will, for example, have to implement
DatabaseMetadata.getCatalogTerm
, and it will return "database". We will also have to implementDatabaseMetadata.getSchemaTerm
, and it will also return "database".Yes, that cannot be implemented. Given that MongoDB database is nothing but a namespace from the MQL perspective, the
$lookup.from
limitation "collection in the same database" is weird.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess you meant the following two methods from db metadata:
However, I tried to search for their usage and found Hibernate ORM never used them at all (Hibernate only used a very small subset of the metadata).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. you meant our MongoDB metadata should set these terms with value of
database
, even though Hibernate doesn't care about it at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created HIBERNATE-38 Design, implement and document how an application can configure the product and HIBERNATE-39 Support @Table.schema, which are meant to make the things discussed here actionable.
I also made HIBERNATE-28 provide MongoClientSettings customization approach dependent on HIBERNATE-38 Design, implement and document how an application can configure the product. Though, I see a way to make them independent, and given that you have already created the add programmatic Mongo client building customization PR, I'll propose that approach there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you. I fixed the text:
Connection
->DatabaseMetadata