> -----Original Message----- > From: Bruno Dumon [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 09, 2003 11:05 AM > To: [EMAIL PROTECTED] > Subject: Re: "Remove" problems with the Woody sample > > > On Sat, 2003-09-06 at 13:39, Hugo Burm wrote: > > This is about the "Bean Binding" sample on the Woody samples > page, and the > > "Remove" option of the Contacts on this page. > > (Cocoon version: 2.1.2, one day after the release of 2.1.1) > > > > 1) > > If I have more than one Contact (e.g. by adding the lines > > contact = new Packages.org.apache.cocoon.woody.samples.Contact(); > > contact.setId("2"); > > contact.setFirstName("Hugo"); > > bean.addContact(contact); > > to the "form2bean" function in "binding_example.js"), > > I cannot delete more than one at a time. When I check two > Contacts, Click on > > "Remove selected contacts", then only one of them is removed. > > You mean that only one is removed _after performing the binding_, right? > They are both removed from the repeater-widget, but there's something > wrong in the repeater binding indeed. It doesn't work for binding to XML > documents either.
Yes, that is wat I meant. After pressing "Submit Query", one of the two contacts that was just removed by the repeater, re-appears. Sorry for not explaining that clearly. > > This seems to be caused by the classical problem when removing items > from a list while running through it. > > I've tried to solve this by first storing the JXPathContexts of the > items to delete in a seperate list, and then running backwards through > that list, and it seems to work all right. Will commit this soon. > > Thanks for reporting this problem! > Thanks for repairing it. > > > > 2) > > The Contacts are not removed from the ArrayList. By the Remove > option, all > > relevant keys of the Contact are set to null, so you will never > see it again > > in this context. But the item is not removed from the list. This is a > > problem if you have a persistence framework flushing the list > to hard disk > > (zombie records in your database). > > > > Not sure that I follow here: I suppose that if I don't see the item > anymore on jx-generated page, it really isn't in the arraylist anymore? > Because this occured both for the standaard Woody repeater and for my own map-repeater which uses Maps instead of ArrayLists, I concluded it was a Woody problem. But now I did some additionally checks, it looks like it is a Hibernate problem. Hibernate is doing runtime reflection: it replaces the instances of the classes like Maps, Lists, Sets with its own instances in order to do its O/R mapping. May be there is a problem with JXPath. I have to post this to some other list. > > > > I checked the Woody source. I guess it must be the JXPath > removePath() in > > DeleteNodeJXPathBinding.java. > > What is this removePath() supposed to do? > > Remove the addressed path. If it addresses an item in a collection, it > means removing the item from the collection. That was what I was wondering about: does it actually remove it from the Collection, or does it just set all keys to null, like it is doing in my environment. But now I have some obvious suspects for the latter behaviour (the combination of Hibernate annd JXPath) > > -- > Bruno Dumon http://outerthought.org/ > Outerthought - Open Source, Java & XML Competence Support Center > [EMAIL PROTECTED] [EMAIL PROTECTED] > > Hugo Burm