Hello all,
While trying to fix one of Envers issues, I have encountered difficulties
inserting one-to-one relation mapped with join table. All audit entities
generated by Envers follow EntityMode.MAP pattern. Simple hibernate-core
test case -
https://gist.github.com/lukasz-antoniak/5929345 - fails because
INSERT statement populating WIFE_HUSBAND table precedes creation of HUSBAND
record. The workaround would be to skip populating referenced record id in
the entity that is saved first (comment out line "wifeRecord.put(
"husband_id", 2l );"). Would you classify such Hibernate behavior as a
bug?
I can see advantages of both approaches - simplicity (current situation)
vs. compatibility with classic POJO behavior.
Regards,
Lukasz