Vincent -- The PersistenceBroker interface defines two methods for storing an object:
public void store(Object) public void store(Object,ObjectModification) If you use the first 'store' method, OJB will run a query against the database to determine if the Object that is being stored already exists. If the record exists, then OJB will update that record. If the record doesn't exist, then OJB will insert a new record. Based on the description of your problem, you're using the first 'store' method. To change this behavior, just use the second method and pass either ObjectModificationDefaultImpl.INSERT or ObjectModificationDefaultImpl.UPDATE as the second argument. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -----Original Message----- From: Arbona Vincent [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 8:36 AM To: [EMAIL PROTECTED] Subject: Problem on insert Hi, I have the following problem: I am using the PB API and I want to ensure that when an object is stored in base, it is not possible to insert it twice (ie to insert an object with the same PK value) Until now, the second insert is in fact an update!! But what I want is an Exception that tells me "This object already exists" or something like that Thanks Vincent ARBONA Architecte Logiciel Sopra Group Espace Performance 3 Bâtiment P 35760 Saint Grégoire [EMAIL PROTECTED] tel : 02-23-25-25-73 fax : 02-23-25-25-26 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]