Skip to content

Commit

Permalink
Revert "HHH-15159 Orphan removal of an entity with an @ElementCollection
Browse files Browse the repository at this point in the history
 causes a ConstraintViolationException"

This reverts commit 41b067e.
  • Loading branch information
beikov committed Sep 2, 2022
1 parent 41b067e commit 12a30b5
Showing 1 changed file with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,7 @@ 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>() {
Expand Down Expand Up @@ -182,6 +166,19 @@ ExecutableList<QueuedOperationCollectionAction> init(ActionQueue instance) {
}
}
);
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>() {
Expand Down

0 comments on commit 12a30b5

Please sign in to comment.