Skip to content

Hibernate nastiness using the one-to-one mapping.

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!


  1. define two classes (Primary, Secondary) that have a one-to-one relationship.
  2. use the native generator to generate a primary key for each.
  3. save a primary with no assigned secondary object.
  4. save another primary with a secondary object.
  5. retrieve the first primary and it will have the secondary object saved in previous step.
  6. retrieve the second primary and it will have no secondary object.

Talk about ouch!

Posted in hibernate, technical.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.