HHH-16907 moved if from inside private method to around
This improves performance of cascadeLogicalOneToOneOrphanRemoval handling, because entity fields are only read by reflection if the field is actually a 1:1 relation (before the change, this was done every time for every field)
This commit is contained in:
parent
7c378847cb
commit
f55c017f59
|
@ -174,7 +174,7 @@ public final class Cascade {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// If the property is uninitialized, then there cannot be any orphans.
|
// If the property is uninitialized, then there cannot be any orphans.
|
||||||
if ( action.deleteOrphans() && !isUninitializedProperty ) {
|
if ( action.deleteOrphans() && !isUninitializedProperty && isLogicalOneToOne( type ) ) {
|
||||||
cascadeLogicalOneToOneOrphanRemoval(
|
cascadeLogicalOneToOneOrphanRemoval(
|
||||||
action,
|
action,
|
||||||
eventSource,
|
eventSource,
|
||||||
|
@ -252,7 +252,7 @@ public final class Cascade {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( isLogicalOneToOne( type ) ) {
|
||||||
cascadeLogicalOneToOneOrphanRemoval(
|
cascadeLogicalOneToOneOrphanRemoval(
|
||||||
action,
|
action,
|
||||||
eventSource,
|
eventSource,
|
||||||
|
@ -264,7 +264,9 @@ public final class Cascade {
|
||||||
propertyName,
|
propertyName,
|
||||||
isCascadeDeleteEnabled );
|
isCascadeDeleteEnabled );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** potentially we need to handle orphan deletes for one-to-ones here...*/
|
||||||
private static <T> void cascadeLogicalOneToOneOrphanRemoval(
|
private static <T> void cascadeLogicalOneToOneOrphanRemoval(
|
||||||
final CascadingAction<T> action,
|
final CascadingAction<T> action,
|
||||||
final EventSource eventSource,
|
final EventSource eventSource,
|
||||||
|
@ -276,8 +278,6 @@ public final class Cascade {
|
||||||
final String propertyName,
|
final String propertyName,
|
||||||
final boolean isCascadeDeleteEnabled) throws HibernateException {
|
final boolean isCascadeDeleteEnabled) throws HibernateException {
|
||||||
|
|
||||||
// potentially we need to handle orphan deletes for one-to-ones here...
|
|
||||||
if ( isLogicalOneToOne( type ) ) {
|
|
||||||
// We have a physical or logical one-to-one. See if the attribute cascade settings and action-type require
|
// We have a physical or logical one-to-one. See if the attribute cascade settings and action-type require
|
||||||
// orphan checking
|
// orphan checking
|
||||||
if ( style.hasOrphanDelete() && action.deleteOrphans() ) {
|
if ( style.hasOrphanDelete() && action.deleteOrphans() ) {
|
||||||
|
@ -363,7 +363,6 @@ public final class Cascade {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the association is a one to one in the logical model (either a shared-pk
|
* Check if the association is a one to one in the logical model (either a shared-pk
|
||||||
|
|
Loading…
Reference in New Issue