Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduced new JDBC dialect counterparts #2036

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

Closed
mipo256 wants to merge 2 commits into spring-projects:main from mipo256:GH-2031

Conversation

Copy link
Contributor

@mipo256 mipo256 commented Apr 20, 2025
edited
Loading

Closes #2031

The idea is to introduce for each relational Dialect its jdbc counterpart. All the Jdbc dialects that were already in place (there were a couple of those) and added ones now extend the JdbcDialect and their corresponding relational counterpart.

CC: @mp911de @schauder


@Nullable
private static Dialect getDialect(Connection connection) throws SQLException {
private static JdbcDialect getDialect(Connection connection) throws SQLException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, here I am not sure what is the best solution. Let me clarify. The JdbcDialectProvider interface is defined like this:

public interface JdbcDialectProvider {
 Optional<Dialect> getDialect(JdbcOperations operations);
}

The common sense dictates, that since it is a DialectProvider for JDBC, then the returned dialect is supposed to be an instance of JdbcDialect. However, such type migration change would not be backward compatible.

The solution I can think of is to deprecate this method in the interface, and maybe even make JdbcDialectProvider a top-level interface, instead of being an inner one. And in this case, we can direct users to a new interface to be used, where getDialect method returns the Optional<JdbcDialect>

If we just deprecate the JdbcDialectProvider#getDialect method, we will not be able to say at the moment what is the replacement.

Maybe I'm just overcomplicating things... I need your option, Mark @mp911de

Copy link
Member

Choose a reason for hiding this comment

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

We would split the change into two parts. Updating JdbcDialectProvider to return JdbcDialect in the signature would be a change shipped with the next major release.

For the 3.5 release, it should be fine to have an adapter that translates a generic Dialect into JdbcDialect and from DialectResolver.getDialect(...) we can directly return JdbcDialect.

mipo256 reacted with thumbs up emoji
Signed-off-by: mipo256 <mikhailpolivakha@gmail.com>
@mp911de mp911de self-assigned this Apr 24, 2025
@mp911de mp911de added this to the 3.5 GA (202500) milestone Apr 24, 2025
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 24, 2025
Deprecate original DialectResolver and JdbcArrayColumns as they've been in the wrong package and introduce replacements in the dialect package. Let deprecated types extend from their replacements to retain compatibility.
Make instance holders final, fix Javadoc typos, update reference docs.
@mp911de mp911de changed the title (削除) GH-2031 Introduced new JDBC dialect counterparts (削除ここまで) (追記) Introduced new JDBC dialect counterparts (追記ここまで) Apr 24, 2025
@mp911de mp911de requested a review from schauder April 24, 2025 08:47
Copy link
Member

mp911de commented Apr 24, 2025

@schauder can you have a look after a round of polishing? Going forward, we would drop the deprecated elements in 4.0 and update the configuration so that we exclusively require JdbcDialect.

mipo256 reacted with thumbs up emoji

Copy link
Contributor Author

mipo256 commented Apr 24, 2025

Sure, I would take a look into your changes @mp911de, I'll reply shortly

* Exception thrown when {@link DialectResolver} cannot resolve a {@link Dialect}.
*/
public static class NoDialectException extends NonTransientDataAccessException {
@Deprecated(since = "3.5", forRemoval = true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can add a javadoc @deprecated tag here? Just in case to specify the replacement like in other parts of the old DialectResolver...

Copy link
Contributor Author

mipo256 commented Apr 24, 2025

@mp911de I think it is great overall. I only have the minor comment above.

As a side note, I can provide a PR for 4.x milestone to got rid of those classes once this is merged.

@mipo256 mipo256 requested a review from mp911de April 24, 2025 10:09
schauder pushed a commit that referenced this pull request May 8, 2025
Signed-off-by: mipo256 <mikhailpolivakha@gmail.com>
Commit message edited by Jens Schauder
Original pull request #2036
Closes #2031 
schauder pushed a commit that referenced this pull request May 8, 2025
Deprecate original DialectResolver and JdbcArrayColumns as they've been in the wrong package and introduce replacements in the dialect package. Let deprecated types extend from their replacements to retain compatibility.
Make instance holders final, fix Javadoc typos, update reference docs.
Original pull request #2036
See #2031 
schauder added a commit that referenced this pull request May 8, 2025
Code style and formatting.
Original pull request #2036
See #2031 
Copy link
Contributor

schauder commented May 8, 2025

Thanks everyone. That's merged.

mipo256 reacted with rocket emoji

schauder pushed a commit that referenced this pull request May 8, 2025
Signed-off-by: mipo256 <mikhailpolivakha@gmail.com>
Commit message edited by Jens Schauder
Original pull request #2036
Closes #2031 
schauder pushed a commit that referenced this pull request May 8, 2025
Deprecate original DialectResolver and JdbcArrayColumns as they've been in the wrong package and introduce replacements in the dialect package. Let deprecated types extend from their replacements to retain compatibility.
Make instance holders final, fix Javadoc typos, update reference docs.
Original pull request #2036
See #2031 
schauder added a commit that referenced this pull request May 8, 2025
Code style and formatting.
Original pull request #2036
See #2031 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@schauder schauder Awaiting requested review from schauder

@mp911de mp911de Awaiting requested review from mp911de

Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce JDBC-specific dialects in JDBC module

AltStyle によって変換されたページ (->オリジナル) /