The system prefers to generate a new ID instead of using the one the programmer provides. The replicate action doesn't say you will do that but the opposite. Use the id provided by programmer. Offending code is: final boolean regenerate = persister.isIdentifierAssignedByInsert(); // prefer re-generation of identity! final EntityKey key = regenerate ? null : source.generateEntityKey( id, persister ); Even hibernate documentation says that: /**
- Persist the state of the given detached instance, reusing the current
- identifier value. This operation cascades to associated instances if
- the association is mapped with {@code cascade="replicate"}
*
- @param object a detached instance of a persistent class
- @param replicationMode The replication mode to use
*/
|