One-to-one relation with shared primary key

We have a one-to-one association from a main class to another underline class with the same primary key. The main class use the identity strategy for generating the primary. The constrained attribute is set to true.

When we try to persist the main object including it’s dependent object using cascading, hibernate throws an IdentifierGenerationException ‘null id generated for:class …’ on the depend object.

How to solve this issue?

You need to add your entity mappings and the data access code you use to save the entities.