Is it possible to declare in Hibernate a perfect one-to-one association between a shared primary key, this is, all the values in a PK column need to be exactly the same in another PK column.
Generally, a one-to-one mapping defines a foreign key such as in the book, p. 279), but it just enforces that the ADDRESS_ID values appear in the USER_ID column, but not the other way around.
This is quite an hard problem in the relational database, because it implies cyclic foreign keys such as in
http://sqlserver-tips.blogspot.com/2006 ... nship.html, what I presume not to be a standard solution.
I wonder if Hibernate could handle this property since it is hard to express in the database itself. This, of course, would require to insert the corresponding user when inserting a new address and vice-versa, and the application would enforce it to happen.
Many thanks,
hugo