HHH-12569 - Fix ordered inserts constraint violation when using a OneToOne with a JoinColumn.

This commit is contained in:
Chris Cranford 2018-05-17 15:58:06 -04:00
parent 3c3dc88283
commit de44e4180d
1 changed files with 20 additions and 18 deletions

View File

@ -1272,7 +1272,9 @@ public class ActionQueue {
final String rootEntityName = action.getSession().getFactory().getMetamodel().entityPersister( entityName ).getRootEntityName();
if ( entityType.isOneToOne() && OneToOneType.class.cast( entityType ).getForeignKeyDirection() == ForeignKeyDirection.TO_PARENT ) {
batchIdentifier.getChildEntityNames().add( entityName );
if ( !entityType.isReferenceToPrimaryKey() ) {
batchIdentifier.getChildEntityNames().add( entityName );
}
if ( !rootEntityName.equals( entityName ) ) {
batchIdentifier.getChildEntityNames().add( rootEntityName );
}