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]



Reply via email to