Skip to content

Commit

Permalink
AS7-6132 Modernise the cascadeDelete method with generics to remove the
Browse files Browse the repository at this point in the history
downcast problem
  • Loading branch information
sfcoy authored and bstansberry committed Dec 11, 2012
1 parent 63b79f5 commit eafe7ee
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,9 @@ public void setValue(CmpEntityBeanContext ctx, Object value) {
}

public void cascadeDelete(CmpEntityBeanContext ctx) throws RemoveException {
Collection value = (Collection) getValue(ctx);
if (!value.isEmpty()) {
EJBLocalObject[] locals = (EJBLocalObject[]) value.toArray();
for (int i = 0; i < locals.length; ++i) {
locals[i].remove();
}
Collection<EJBLocalObject> cmrs = (Collection<EJBLocalObject>) getValue(ctx);
for (EJBLocalObject localEjb : cmrs) {
localEjb.remove();
}
}

Expand Down Expand Up @@ -1118,8 +1115,7 @@ private interface CMRFieldLoader {
void addRelatedId(CmpEntityBeanContext ctx, Object relatedId);
}

private class CMRSet
implements Set {
private class CMRSet implements Set {
private final CmpEntityBeanContext ctx;
private final CollectionValuedFieldState state;

Expand Down

0 comments on commit eafe7ee

Please sign in to comment.