AW: [Objectbridge-developers] Automated deletion of depending obj ects
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2001-09-25 15:05:05
|
Hi Rainer, > -----Urspr=FCngliche Nachricht----- > Von: Bischof, Rainer [mailto:rai...@ed...] > Gesendet: Dienstag, 25. September 2001 16:53 > An: 'obj...@li...' > Betreff: [Objectbridge-developers] Automated deletion of depending > objects > Wichtigkeit: Hoch >=20 >=20 > Hi Thomas, >=20 > somewhere I have read that OJB supports automated deletion of=20 > depending > objects in a 1-m relationship. The question is: how do I do that? >=20 > I have an object which contains a Vector of depending=20 > objects. I want to > delete one of these. So I just open a transaction, get a=20 > handle to the main > object and remove one of the depending objects from the Vector. On > transaction submit I would expect that OJB removes the=20 > corresponding row in > the table. >=20 > This does not happen for me ;-( > Mapping has "true" entries for automated retrieval, update=20 > and delete. Do I > need to use an ODMG collection instead of the Vector? >=20 Yes, you need object level transactions that come only with ODMG ! See excerpt from the FAQ: Say you use the PB to query an object O that has a collection attribute = col with five elements a,b,c,d,e. Next you delete Objects d and e from col = and store O again with PersistenceBroker.store(O); PB will store the remaining objects a,b,c. But it will NOT delete d and = e ! If you then requery object O it will again contain a,b,c,d,e !!!=20 The PB keeps no transactional state of the persistent Objects, thus it = does not know that d and e have to be deleted. (as a side note: deletion of = d and e could also be an error, as there might be references to them from = other objects !!!) Using ODMG for the above scenario will eliminate all trouble: Objects = are registered to a transaction so that on commit of the transaction it = knows that d and e do not longer belong to the collection. the ODMG = collection will not delete the objects d and e but only the REFERENCES from the collection to those objects! > Thanks > Rainer >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |