Skip to content

Map boolean values to 0 or 1 if dialect is SqlServerDialect. #936

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
wants to merge 4 commits into from

Conversation

manousos
Copy link
Contributor

Closes #908

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 10, 2021
@schauder schauder self-requested a review March 11, 2021 05:57
@schauder schauder self-assigned this Mar 11, 2021
@@ -402,10 +403,16 @@ private Condition createCondition(Column column, @Nullable Object mappedValue, i
}

if (comparator == Comparator.IS_TRUE) {
if (dialect instanceof SqlServerDialect) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything that is database specific needs to go into the Dialect. Instanceof checks for the Dialect implementation are a hard no-go.

I'm wondering if a better way to handle this is to register a converter for booleans that we then apply to the value.

Copy link
Contributor Author

@manousos manousos Mar 11, 2021

Choose a reason for hiding this comment

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

I will introduce a new default method at Dialect interface to handle boolean values.

…SqlServer dialect.

Signed-off-by: Manousos Mathioudakis <[email protected]>
@manousos manousos requested a review from schauder March 12, 2021 09:21
@gregturn gregturn changed the base branch from master to main April 15, 2021 18:21
@schauder
Copy link
Contributor

schauder commented May 4, 2021

We discussed this internally and decided not to go with this approach.
Instead we'll allow dialects to register conversions and apply conversions on the parameter.

@schauder schauder closed this May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MSSQL bit wrongly mapped to boolean value TRUE
3 participants