I’ve created a PR with a fix, but an as yet to be completed test. Inlined from the PR:
This PR is for discussion purposes only. The fix addresses the issue described in my application, but I've not yet been able to get a test configuration to mimic the break.
The issue is that the test code does not lead to the use of a BasicProxyFactoryImpl for the composite unique constraint, whereas in my application this is the case.
Digging through debug stack traces, I suspect this is because in my application Hibernate is representing the constraint in the entityMetamodel as an:
EntityBasedCompositionAttribute : Attribute(name=unique-props, type=component[guid,customer] [non-identifier,composition])
Whereas in my test code it is a:
EntityBasedAssociationAttribute : Attribute(name=discriminator, type=org.hibernate.test.uniqueproperties.UniquePropertiesTest$Discriminator [non-identifier,association])`
Any thoughts on how to change the test configuration to have it exercise a BasicProxyFactoryImpl would be greatly appreciated.
(Note: the commented out test was an initial PoC on test setup - I will clean this up having resolved the above)
I’ll keep plugging away at the test, but any pointers would be received with gratitude!