Skip to content

Support TypedParameterValue of hibernate-orm #2366

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
heowc opened this issue Nov 29, 2021 · 4 comments
Closed

Support TypedParameterValue of hibernate-orm #2366

heowc opened this issue Nov 29, 2021 · 4 comments
Assignees
Labels
status: feedback-provided Feedback has been provided

Comments

@heowc
Copy link
Contributor

heowc commented Nov 29, 2021

hibernate-orm supports TypedParameterValue for binding parameters.
Are you thinking of supporting this?

See https://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/jpa/TypedParameterValue.html

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 29, 2021
@schauder schauder self-assigned this Nov 29, 2021
@heowc heowc closed this as completed Nov 30, 2021
@heowc heowc reopened this Nov 30, 2021
@schauder
Copy link
Contributor

If I understand how TypedParameterValue is to be used, I'd have thought it would already work.
But I guess since you ask for support it doesn't.

Could you provide an example where it doesn't work and how you would like it to work?

@schauder schauder added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 30, 2021
@heowc
Copy link
Contributor Author

heowc commented Dec 1, 2021

I wasn't good at testing, and it was already supported.

However, I thought I would like to use it in a different way. 🤔

For example:

  1. We usually create a separate interface that inherits from JpaRepository. (ex, AccountRepository)
  2. And by writing methods and @Query, it works internally as a named query or a native query.
  3. Here, there is an issue where the native query does not know the exact type as a result. If null , this type is not clearly known. And this behaves differently depending on the sql-driver. (I found the following issue with hibernate: https://hibernate.atlassian.net/browse/HHH-14778)
  4. To solve this, we use TypedParameterValue to tell hibernate the type.
  5. If we use spring-data-jpa and write a method in the interface, we know the parameter, so if we wrap it with TypedParameterValue internally, there is no need to do the same thing as in 4.

WDYT?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 1, 2021
@schauder
Copy link
Contributor

schauder commented Dec 1, 2021

Thanks for confirming that TypedParameterValue is properly supported.

As for the new idea. Could you please create a separate issue for it, so we can have one issue per idea/problem?

@heowc
Copy link
Contributor Author

heowc commented Dec 1, 2021

I close the issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants