Re: Deleting items in collection?
Sebastian Stein <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Vasily Ivanov <[email protected]> [060821 23:46]: > >if I delete an ClassB object from the collection in > >ClassA and store the ClassA object again, this > >ClassB object is not removed from the database > It depends on how you delete this object from collection. You should > get object (aObject) with all references using OJB query, first. Than > remove object (bObject) from collection (by calling > aObject.getBs().remove(bObject)) and than call broker.store(aObject). > That should remove bObject from db. I really don't understand why it is not working. I do the following: aObject.getBs().clear(); aObject.getBs().addAll(newBs); But the old Bs are not removed, just the new Bs are added. This is the case if I have auto-delete="false" in the repository.xml for the definition of the objectB collection. If I turn it on, it deletes all Bs without adding them again. It is very strange. Sebastian PS: If you are interested I can also point you directly to the code, it is public.