Emmanuel Dupont wrote:
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.
OQL queries are slower than PB queries, because they have to be parsed first.
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 ?
I don't think the second choice is better!
-----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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]