Skip to content

Use Class, Enum, Constants, ... inside @Query anontation #3651

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
nhaphanse opened this issue Oct 26, 2024 · 3 comments
Closed

Use Class, Enum, Constants, ... inside @Query anontation #3651

nhaphanse opened this issue Oct 26, 2024 · 3 comments

Comments

@nhaphanse
Copy link

nhaphanse commented Oct 26, 2024

Dear Team,

I hope this message finds you well.

I wanted to bring up a concern regarding the use of DTO projects, particularly when it comes to utilizing constants in @query annotations without specifying their full relative paths. For example, I currently have the following query:

@Query("select new com.food.customer.CustomerModel(c.id, c.name) " +
       "from Customer c where c.id = com.food.customer.CustomerModel.ORIGINAL")
List<CustomerModel> findCustomerModel();

While the integrator can assist to some extent, the long and often duplicated paths can be quite inconvenient in our projects.

Could you please provide support in finding a more efficient solution for this situation? Your assistance would greatly enhance our workflow.

Thank you for your help!

David

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 26, 2024
@nhaphanse nhaphanse changed the title Use Class, Enum, ... in side @Query anotaion Use Class, Enum, Constants, ... inside @Query anontation Oct 26, 2024
@mp911de
Copy link
Member

mp911de commented Oct 28, 2024

We're exploring DTO rewriting with #3076. Our query rewriting is intentionally limited. We do not want to parse queries in order to build another model of the query. For using constants: You can always use parametrized queries and pass in the external value.

Hibernate calls out that enum literals do not require qualifiers.

Any non-entity-related constants must be fully-qualified.

That being said, it seems that there's nothing actionable left in the ticket.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Oct 28, 2024
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Nov 4, 2024
@spring-projects-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants