I tested with: broker.store(instance) and with an ODMG query who look in the database if the object is already present or not before inserting it.
It seems that (via P6Spy) the first choice (broker.store) has better performance. Why do you think Thomas that the second choice (query the existence or not for each object Updated in database via ODMG API before insert it) must be preferred ? -----Message d'origine----- De�: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoy�: jeudi 19 juin 2003 11:28 ��: OJB Users List Objet�: Re: RE : Updating Objects Hi Emmanuel Dupont wrote: > Hi Thomas, Hi Eric > > I understand that OJB doesn't mind about this update method but what about > the database? > > If I create a new Object with the same Id (witch is the corresponding > primary key ID) and I persisting it, I have a "Double PRIMARY KEY constraint > ERROR" in my database. If you call broker.store(instance) OJB will check if the instance is already present in the db. In Erics example it will perform an UPDATE, not an INSERT! > So it is not possible to use this method ......No? > > > -----Message d'origine----- > De : Mahler Thomas [mailto:[EMAIL PROTECTED] > Envoy� : mercredi 18 juin 2003 16:40 > � : 'OJB Users List' > Objet : RE: Updating Objects > > Hi Eric, > > >> >>Is it appropriate to update a persisted object by creating an >>new object >>with same id as the persisted object and then persisting the >>new object? > > > I don't think this is "best practise". But there may be reasons to such > things... > At least from an OJB point of view I see no harm... > > cheers, > thomas > > >>In >>case your curious, it does properly update the database. >> >>Eric >> >> >> >> >> >>DISCLAIMER: The information contained in this e-mail is, >>unless otherwise >>indicated, confidential and is intended solely for the use of >>the named >>addressee. Access, copying or re-use of the e-mail or any information >>contained therein by any other person is not authorized. If >>you are not the >>intended recipient please notify us immediately by returning >>the e-mail to >>the originator. >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
