AW: [OJB-developers] Let's fix the testsuite!
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2002-05-29 08:52:56
|
Hi Oleg, > -----Ursprungliche Nachricht----- > Von: =D0=ED=E5=FA =CF=EA=E7 [mailto:on...@uk...] > Gesendet: Mittwoch, 29. Mai 2002 10:42 > An: obj...@so... > Betreff: Re: [OJB-developers] Let's fix the testsuite! >=20 >=20 > Hi Thomas, >=20 > I am afraid I was not clear enough, actually I proposed two=20 > alternatives, and you commented only the first one, see below. >=20 sorry, I missed that it were two separate suggestions. > -----Original Message----- > From: Thomas Mahler <tho...@ho...> > To: Oleg Nitz <on...@uk...> > Date: Tue, 28 May 2002 23:05:59 +0200 > Subject: Re: AW: [OJB-developers] Let's fix the testsuite! >=20 > > > I see. To achieve this we should either=20 >=20 > 1) > > > remember the original state of the m:n relation=20 > You commented this one, and I agree that it requires locks. >=20 > > > or=20 >=20 > 2) > > > to read the set of all indirection instances from the=20 > > > database in storeMtoNImplementor(), then compare them against=20 > > > the current set of indirection instances in memory,=20 > > > then insert/delete the two differences of two sets.=20 > > > Then there is no need in multiple database lookups. > This approach is almost as simple as yours. > First we execute=20 > SELECT fk_for_items FROM indirect_table WHERE fk_for_this=3D? > and put then into the set1 > The identities for the current m:n collection we put into set2 > Then we calculate "set1 minus set2" and DELETE these records > Then we calculate "set2 minus set1" and INSERT these records >=20 I agree, this is also quite simple and will eliminate superfluous = DELETEs ! This is even better than my idea. cheers, Thomas > > A much simpler aproach: > > before inserting entries for a given relation in=20 > storeMtoNImplementor(),=20 > > just delete all existing entries. > > This way we > > - can avoid exception caused by failing inserts, > > - won't need to track object state to detect removed entries. > > Overhead should be rather small we'll need to execute only=20 > one DELETE=20 > > statement. > You are right, we need to execute only one DELETE statement,=20 > but every time we will execute 1 DELETE and many INSERTs,=20 > even if nothing changed. > With my 2nd approach we will execute 1 SELECT and the number=20 > of DELETEs and INSERTs that is really necessary, i.e. zero if=20 > nothing changed. > And in general this approach seems more careful :) > Do you agree? >=20 > Oleg >=20 > _______________________________________________________________ >=20 > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- = http://devcon.sprintpcs.com/adp/index.cfm >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |