hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-18228: Fix hibernate-tool code generation (ClassNotFoundException)

Open fanste opened this issue 1 year ago • 3 comments

Foreign keys based on compound keys run into a check for java records. But the to-be-generated classes do not exist on the classpath and therefore the check fails.

Issue: https://hibernate.atlassian.net/browse/HHH-18228

fanste avatar Jun 13 '24 15:06 fanste

Any feedback on this?

fanste avatar Jul 04 '24 13:07 fanste

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

Hibernate doesn't seem to be dead... So the project is simply not interested in community contributions?! Would be too sad, if no solution will be implemented for that problem...

fanste avatar Sep 20 '24 15:09 fanste

Reproducer: https://github.com/fanste/reproducers/tree/hhh-18228

Run it using the command mvn generate-sources.

This should throw the following error:

[ERROR] Failed to execute goal org.hibernate.tool:hibernate-tools-maven:6.6.2.Final:hbm2java (entity-generation) on project hhh-18228: Execution entity-generation of goal org.hibernate.tool:hibernate-tools-maven:6.6.2.Final:hbm2java failed: component class not found: Tbltest1Id

Reason is the compound primary key of tblTest1 also used as a foreign key in tblTest2. The demonstrated use case is simplied to the bare minimum.

fanste avatar Dec 16 '24 17:12 fanste

Fixed by HBX-2840 / hibernate-tools#4986

fanste avatar Mar 10 '25 16:03 fanste