Hibernate nastiness filed as bug HHH-2128. When reading this please notice that this situation arose from the most minimal definition. Using the ‘defaults’ is what caused this issue!
- define two classes (Primary, Secondary) that have a one-to-one relationship.
- use the native generator to generate a primary key for each.
- save a primary with no assigned secondary object.
- save another primary with a secondary object.
- retrieve the first primary and it will have the secondary object saved in previous step.
- retrieve the second primary and it will have no secondary object.
Talk about ouch!