Skip to content

Improvements to clarify type using TypedParameterValue #2461

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 1 commit into from

Conversation

heowc
Copy link
Contributor

@heowc heowc commented Mar 8, 2022

  • For Hibernate provider, create HibernateJpaParametersParameterAccessor not JpaParametersParameterAccessor
  • Create TypedParameterValue by fetching parameter type from HibernateJpaParametersParameterAccessor

Close #2370

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

- For Hibernate provider, create `HibernateJpaParametersParameterAccessor` not `JpaParametersParameterAccessor`
- Create `TypedParameterValue` by fetching parameter type from `HibernateJpaParametersParameterAccessor`
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 8, 2022
schauder pushed a commit that referenced this pull request Mar 10, 2022
This avoids problems where a JDBC driver fails to determine the correct type for such values.

Closes #2370
Original pull request #2461
schauder added a commit that referenced this pull request Mar 10, 2022
Replaced type check by method providing the correct JpaParameterParameterAccessor.
Formatting.

See #2370
Original pull request #2461
schauder pushed a commit that referenced this pull request Mar 10, 2022
This avoids problems where a JDBC driver fails to determine the correct type for such values.

Closes #2370
Original pull request #2461
schauder added a commit that referenced this pull request Mar 10, 2022
Replaced type check by method providing the correct JpaParameterParameterAccessor.
Formatting.

See #2370
Original pull request #2461
@schauder
Copy link
Contributor

Thanks for your work, that's merged.

@schauder schauder closed this Mar 10, 2022
@heowc heowc deleted the gh-2370 branch March 14, 2022 09:07
@cigaly
Copy link
Contributor

cigaly commented May 15, 2022

There is a problem with this implementation. When EntityManager parameter in constructor is proxy created by SharedEntityManagerCreator, em.unwrap(Session.class) may (or will?) throw IllegalStateException with message "No transactional EntityManager available".

Attached is small change that can fix that problem.

HibernateJpaParametersParameterAccessor.txt

gregturn added a commit that referenced this pull request Jul 13, 2022
Properly handle null values with like or contains.

Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
gregturn added a commit that referenced this pull request Jul 13, 2022
Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
gregturn added a commit that referenced this pull request Jul 13, 2022
Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
gregturn added a commit that referenced this pull request Jul 13, 2022
Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
@gregturn
Copy link
Contributor

@cigaly Please check out the snapshots to see if your issue still persists. If so, please open a new ticket.

gregturn added a commit that referenced this pull request Sep 23, 2022
Null values are wrapped with a special handler when interacting with Hibernate. However, this becomes an issue for queries when LIKE or CONTAINS are applied. In this situation, the null needs to be condensed into an empty string and any wildcards can then be applied with expected results.

Closes #2548, #2570.
Supercedes: #2585.
Related: #2461, #2544#
gregturn added a commit that referenced this pull request Nov 7, 2022
gregturn added a commit that referenced this pull request Nov 9, 2022
gregturn added a commit that referenced this pull request Nov 9, 2022
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.

Improvements to clarify type using TypedParameterValue
5 participants