Forgot the stack trace.
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
at java.util.ArrayList$Itr.next(ArrayList.java:791)
at
org.apache.openjpa.util.ProxyCollections$1.next(ProxyCollections.java:191)
at
com.copperarrow.veilig.mainui.ui.dialogs.EditEntryDialog.actionPerformed(EditEntryDialog.java:191)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
[catch] at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
at java.awt.Dialog.show(Dialog.java:1082)
at
org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1074)
at
org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1109)
at
org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1096)
at
org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:126)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1363)
at org.openide.util.Mutex.readAccess(Mutex.java:273)
at
org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1081)
at java.awt.Component.show(Component.java:1651)
at java.awt.Component.setVisible(Component.java:1603)
at java.awt.Window.setVisible(Window.java:1014)
at java.awt.Dialog.setVisible(Dialog.java:1005)
at
org.netbeans.core.windows.services.DialogDisplayerImpl$1AWTQuery.showDialog(DialogDisplayerImpl.java:260)
at
org.netbeans.core.windows.services.DialogDisplayerImpl.notify(DialogDisplayerImpl.java:276)
at
org.netbeans.core.windows.services.DialogDisplayerImpl.notify(DialogDisplayerImpl.java:167)
at
com.copperarrow.veilig.mainui.actions.EditEntryAction.actionPerformed(EditEntryAction.java:43)
at
org.openide.awt.InjectorExactlyOne.actionPerformed(InjectorExactlyOne.java:78)
at
org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:226)
at
org.openide.awt.ContextManager.actionPerformed(ContextManager.java:247)
at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109)
at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93)
at
org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
at
org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
at
org.openide.awt.GeneralAction$BaseDelAction.actionPerformed(GeneralAction.java:234)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
On 28 November 2013 13:09, David Beer <[email protected]> wrote:
> Hi All
>
> I am getting a ConcurrentModificationException when removing an item from
> a @OneToMany List. I am using openjpa 2.2.2 and have the following code for
> the Entity:
>
> @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
> private List<AdditionalInformation> addInfo;
>
> So the Item passed in has all the information, the code to remove an item
> is this.addInfo.remove(ai); where ai is the object to be removed, this is
> removed from the list ok, but once the process has finished that it throws
> a ConcurrentModification Exxception. The item is not removed from the
> database and the process is stopped.
>
> How ever this only occurs if there is more than one item in the list, if I
> remove a single item from the list the item is removed from the list along
> with the reference to hat relationship in the RELATIONSHIP table but not
> from the table for the Entity that is supposed to be removed.
>
> Do I need to remove the item from the database first and then from the
> list?
>
> Any thoughts much appreciated.
>
> Thanks
>
> David
>
>