Community
Participate
Working Groups
When generating bi-directional support for a ordered 1:n-relation then there are some generated features handling the changes that need to be applied to the "n"-list. The method "clearXYZ" seems to be generated incorrectly as it: - iterates over the list with an foreach (for XYZ xyz : XYZs) - and calls "removeXYZ" for every entry (which handles the bi-directional remove) This consequently leads to an ConcurrentModificationException because the list ( which it currently iterates on) is being modified (entries are removed). Imo there are two possible solutions: - Iterate over a copy of the org. list (i.e. for (XYZ xyz : new ArrayList<XYZ>(XYZs)) or - simply remove the first entry from the list until it is empty Code: [Select all] [Show/ hide] while (!XYZs.isEmpty()) { removeXYZ(XYZs.get(0)); }
I have changed the code generation and added a testcase. So this should now be solved. I published a new build containing these issues. Please re-open this issue if it is still encountered. gr. Martin