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

HHH 18705 - Hibernate processor creates bad TypedReferenceQuery when @Entity have name attribute #9064

Merged
merged 3 commits into from
Nov 16, 2024

Conversation

cigaly
Copy link
Contributor

@cigaly cigaly commented Oct 7, 2024

See Jira Issue HHH-18705

Problem can be quickly, but ugly, solved by copy & paste (with small adjustments) methods returnType and entityType from class org.hibernate.processor.annotation.NamedQueryMethod.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@gavinking
Copy link
Member

Ah, thanks for catching this!

Problem can be quickly, but ugly, solved by copy & paste

I hope there's a more elegant way....

@cigaly
Copy link
Contributor Author

cigaly commented Oct 7, 2024

First idea to make better solution is to extract those methods to some helper method and use them on both (or more if needed) places.

@gavinking
Copy link
Member

Sounds good 👍

@gavinking
Copy link
Member

@cigaly Did you mean to leave this in Draft mode, or is it ready now?

@cigaly
Copy link
Contributor Author

cigaly commented Oct 25, 2024

It was (with "disclaimer" that this looks ugly), but I am not quite sure if this will work properly once when inner classes are handled.
It seems that this will work, but one quick test failed, so now there is new puzzle to solve.

@cigaly
Copy link
Contributor Author

cigaly commented Oct 25, 2024

It seems that this is working combination with PR#9098
Only there was minor problem in method from org.hibernate.processor.test.util.TestUtil

@cigaly cigaly marked this pull request as ready for review October 25, 2024 11:35
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

Concept looks good, and it appears to work well, but need to fix the code duplication

Thanks @cigaly

          Ugly copy & paste from org.hibernate.processor.annotation.NamedQueryMethod
@cigaly cigaly force-pushed the HHH-18705 branch 2 times, most recently from 9e2ffa6 to 2b78939 Compare November 15, 2024 14:57
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

OK, LGTM

@gavinking
Copy link
Member

@cigaly are we ready to merge this (after the tests are done)?

@cigaly
Copy link
Contributor Author

cigaly commented Nov 15, 2024

O don't think that here is something missing

@gavinking
Copy link
Member

@cigaly Looks like there's a compilation failure.

        - entityType moved into org.hibernate.processor.Context
        - result/type(returnType) moved into new utility class org.hibernate.processor.util.SqmTypeUtils
@cigaly
Copy link
Contributor Author

cigaly commented Nov 15, 2024

Sorry, I was building using JDK 21 and used 'nice' getFirst() instead of 'ugly' get(0) :-(
Now should be OK

@gavinking gavinking merged commit b1ee3d4 into hibernate:main Nov 16, 2024
21 of 23 checks passed
@gavinking
Copy link
Member

Thanks @cigaly

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

Successfully merging this pull request may close these issues.

2 participants