Hibernate 5.x to 6.3 migration breaks CustomIdGeneration #7410
Replies: 5 comments 3 replies
-
@vladmihalcea, any advice for the latest hibernate version? |
Beta Was this translation helpful? Give feedback.
-
@sebastian-violet I haven't yet tried Hibernate 6.3, so I'm not aware of that issue. However, since you've already acquired knowledge about this Hibernate 6.3 migration, you could also provide a fix for this Hibernate 6.3 migration issue in Hypersistence Utils. Looking forward to your Pull Request. |
Beta Was this translation helpful? Give feedback.
-
@vladmihalcea, I see that you created a Do you want me to checkout that branch, run the test, fix tests and create PR to mainline? I apologize for my lack of knowledge/information on this. |
Beta Was this translation helpful? Give feedback.
-
@sebastian-violet The 63 branch was created as the starting point for the Hibernate 6.3 integration. You can, of course, check out the repository and see what needs to be done in order to make all tests run in that 63 module. |
Beta Was this translation helpful? Give feedback.
-
This is not the place to ask questions, report bugs or request features. Please read #3767 and #4723. |
Beta Was this translation helpful? Give feedback.
-
We had initially created a Custom id generator that would allow JPA entity manager to pass in an id and allow it to flow through to the DB on creation. In the case it was null, the DB's autoincrement would create the ID and return the persisted entity with the created id.
The logic was similar to the
AssignedIdentityGenerator
mentioned hereThe actual implementation looked something like so; found in the following stack overflow answer:
After migrating to Hibernate Core
6.3.1.FINAL
, there doesn't seem to be a way to create an identity generator that respects the requested id generator.When trying to return a null from the recommended
IdentifierGenerator
, then an exception is thrown stating that null is not allowed.I have also tried to return
POST_INSERT_INDICATOR
, but that doesn't seem to be supported since Hibernate6.2
:Tracing through the code, I only see option to pass in
IdentifierGeneratorHelper.SHORT_CIRCUIT_INDICATOR
, but that doesn't work either as it created an entity with a null id which isn't managed by Hibernate.Any advice would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions