-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
HHH-18228: Fix hibernate-tool code generation (ClassNotFoundException) #8565
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I fully understand this use-case: why would the component class, i.e. the class of the generated composite key, not exist while the
componentClassName
does not return null? Maybe the problem is we shouldn't return a class name at all, or we should resolve the class eagerly when generating theComponentType
.Could you please include a test demonstrating the issue within your PR? This can help us understand the problem better and ensure no regressions will be introduced in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The classes are also used by the hibernate-tool project for the code generation. So the to-be-generated XXXId class is present in the DB metadata (because to a compound key) and therefore in the class model but does not yet physically exist.
There is also an active hibernate-tools issue for this: HBX-2840
But I will try to create a standalone reproducer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, hopefully Koen will be able to take a look soon and if we can identify this as a tools issue I'm sure it will be fixed. If you want, you can also try taking a look and proposing a fix, if possible.
Let us know about the test. If you don't mean to continue contributing through this PR, please close it so we can progress with cleanup in our backlog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it is a pure TOOLS issue, as the second-pass processing is setup and run by ORM, based on the metadata feed via TOOLS. See this line in mapping.BasicValue.
Either TOOLS is not allowed to use the classes from CORE anymore - which would be a huge pain in the a.. (i think) or this use case needs to be handled by ORM.
This commit is the root cause of this issue: 3e8056d
Reproducer is attaches as a separat comment.