Hi, Yes if a record with the same PK already exists, calling broker.store() will do an UPDATE against that record. I don't know how to make it throw an exception for duplicate PK... but then the question is, if you want this behaviour, how can OJB differenciate between insert and update?
Thanks and regards, Lee Haw > -----Original Message----- > From: John Woo [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 16, 2003 4:40 AM > To: [EMAIL PROTECTED] > Subject: insert and update > > > > Hi all , > > When I read tutorial 1, I notice that both insert and update uses > > broker.store(product) > > Is there any difference between them ? Say if I accidentally > produce a new product but it already has the another product with > same key in database. So if I insert the new product, will it be > treated like an update ? Can I make that throw something like > duplicated pk instead ? > > And must a table contains a primary key for ojb to work ? > > Thanks for concern > > Perseus > > > > --------------------------------- > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
