Skip to content
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

Process spel values of @QueryHint #3082

Open
ujhazib opened this issue Jul 21, 2023 · 3 comments
Open

Process spel values of @QueryHint #3082

ujhazib opened this issue Jul 21, 2023 · 3 comments
Assignees
Labels
status: feedback-provided Feedback has been provided type: enhancement A general enhancement

Comments

@ujhazib
Copy link

ujhazib commented Jul 21, 2023

Some query hints are very specific values, rather than a boolean, like a timeout on an SQL query. Usually it is not too hard wired in a production grade system but configurable. It is impossible to achieve this behavior with @QueryHints({@QueryHint...}) since the value of QueryHint is not going through on expression language lookup (which would help to get the value at least from a properties/yaml file).
Another possibility I see, and it is somewhat covered in this ticket, is that the JpaRepository interface methods should support some kind of List structure as an input so we can pass them in programatically when we call those methods.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 21, 2023
@christophstrobl christophstrobl added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 24, 2023
@gregturn
Copy link
Contributor

@ujhazib Can you show an example of a type of query hint you'd like to be able to apply in some repository definition?

@gregturn gregturn added the status: waiting-for-feedback We need additional information before we can continue label Jul 28, 2023
@gregturn
Copy link
Contributor

It should be noted that injecting a SpelExpressionParser into the objects that need it to do the evaluation is a bit tricky.

@ujhazib
Copy link
Author

ujhazib commented Aug 1, 2023

Sorry for the slow feedback, was on vacation. One example would be

@QueryHints(
   { @QueryHint(name = org.hibernate.jpa.QueryHints.SPEC_HINT_TIMEOUT, "#{someConfigBean.someTimeoutSetting}") }
)

To detach the timeout setting from a binary compilation and to depend rather on a config file in this case.

@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 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants