AW: [Objectbridge-developers] Automated deletion of depending obj ects
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2001-09-26 09:02:59
|
Hi Rainer, You have to use ODMG Collections to have proper registration of your = objects to transaction. in DListImpl the removing of elemnts is implemented as follows: public Object remove(int index) { DListEntry entry =3D (DListEntry) elements.get(index); TransactionImpl tx =3D getCurrentTransaction(); tx.markDelete(entry); return entry.getRealSubject(); } HTH, -- Thomas > -----Urspr=FCngliche Nachricht----- > Von: Bischof, Rainer [mailto:rai...@ed...] > Gesendet: Mittwoch, 26. September 2001 09:21 > An: obj...@li... > Betreff: RE: [Objectbridge-developers] Automated deletion of = depending > obj ects > Wichtigkeit: Hoch >=20 >=20 > Thanks for your answer Thomas!=20 > I had already seen this in the FAQ and I am using the ODMG=20 > interface. But it > is not clear to me whether I have to use ODMG collections=20 > (DList, etc) or a > normal Vector. > That's all. >=20 > Thanks >=20 >=20 >=20 > Rainer Bischof >=20 >=20 > > -----Original Message----- > > From: Mahler Thomas [mailto:tho...@it...] > > Sent: Dienstag, 25. September 2001 17:04 > > To: Bischof, Rainer; = 'obj...@li...' > > Subject: AW: [Objectbridge-developers] Automated deletion=20 > of depending > > obj ects > >=20 > >=20 > > Hi Rainer, > >=20 > > > -----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 > >=20 > > Yes, you need object level transactions that come only with ODMG ! > >=20 > > See excerpt from the FAQ: > >=20 > > Say you use the PB to query an object O that has a collection=20 > > attribute col > > with five elements a,b,c,d,e. Next you delete Objects d and e=20 > > from col and > > store O again with PersistenceBroker.store(O); > > PB will store the remaining objects a,b,c. But it will NOT=20 > > 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=20 > > Objects, thus it does > > not know that d and e have to be deleted. (as a side note:=20 > > deletion of d and > > e could also be an error, as there might be references to=20 > > them from other > > objects !!!) > > Using ODMG for the above scenario will eliminate all trouble:=20 > > Objects are > > registered to a transaction so that on commit of the=20 > > transaction it knows > > that d and e do not longer belong to the collection. the ODMG=20 > > collection > > will not delete the objects d and e but only the REFERENCES from = the > > collection to those objects! > >=20 > >=20 > > > Thanks > > > Rainer > > >=20 > > >=20 > > > _______________________________________________ > > > Objectbridge-developers mailing list > > > Obj...@li... > > >=20 https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > >=20 >=20 >=20 _______________________________________________ Objectbridge-developers mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-developers |