HHH-15159 Orphan removal of an entity with an @ElementCollection causes a ConstraintViolationException
This commit is contained in:
parent
6c3d700fcc
commit
41b067e5a5
|
@ -107,7 +107,23 @@ public class ActionQueue {
|
|||
private static final LinkedHashMap<Class<? extends Executable>,ListProvider<?>> EXECUTABLE_LISTS_MAP;
|
||||
static {
|
||||
EXECUTABLE_LISTS_MAP = CollectionHelper.linkedMapOfSize( 8 );
|
||||
|
||||
/*
|
||||
CollectionRemoveAction actions have to be executed before OrphanRemovalAction actions, to prevent a constraint violation
|
||||
when deleting an orphan Entity that contains an ElementCollection (see HHH-15159)
|
||||
*/
|
||||
EXECUTABLE_LISTS_MAP.put(
|
||||
CollectionRemoveAction.class,
|
||||
new ListProvider<CollectionRemoveAction>() {
|
||||
ExecutableList<CollectionRemoveAction> get(ActionQueue instance) {
|
||||
return instance.collectionRemovals;
|
||||
}
|
||||
ExecutableList<CollectionRemoveAction> init(ActionQueue instance) {
|
||||
return instance.collectionRemovals = new ExecutableList<>(
|
||||
instance.isOrderUpdatesEnabled()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
EXECUTABLE_LISTS_MAP.put(
|
||||
OrphanRemovalAction.class,
|
||||
new ListProvider<OrphanRemovalAction>() {
|
||||
|
@ -166,19 +182,6 @@ public class ActionQueue {
|
|||
}
|
||||
}
|
||||
);
|
||||
EXECUTABLE_LISTS_MAP.put(
|
||||
CollectionRemoveAction.class,
|
||||
new ListProvider<CollectionRemoveAction>() {
|
||||
ExecutableList<CollectionRemoveAction> get(ActionQueue instance) {
|
||||
return instance.collectionRemovals;
|
||||
}
|
||||
ExecutableList<CollectionRemoveAction> init(ActionQueue instance) {
|
||||
return instance.collectionRemovals = new ExecutableList<>(
|
||||
instance.isOrderUpdatesEnabled()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
EXECUTABLE_LISTS_MAP.put(
|
||||
CollectionUpdateAction.class,
|
||||
new ListProvider<CollectionUpdateAction>() {
|
||||
|
|
Loading…
Reference in New Issue