Anthony -- There are two versions of the store method provided by the PersistenceBroker
store(Object) store(Object,ObjectModification) It appears that you're using the first version. In this case, ojb will first do a select against your db to see if the record exists. If it does, then ojb will do an update. If it doesn't, then ojb will do an insert. To force ojb to do an insert or an update, use the second version of the store method and pass either org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT or org.apache.ojb.broker.util.ObjectModificationDefaultImpl#UPDATE. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: "Anthony E. Carlos" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:47:19 EDT > To: [EMAIL PROTECTED] > Subject: newbie question > > Hello all, > > I'm using the PB API and can store a simple object to a table. Even > though table has a primary key constraint on the id column, if I try to > store a different object with the same id, there is no primary key > constraint violation. In fact, OJB _UPDATES_ the existing matching row > in the database, instead of trying to INSERT a new row (which would > trigger the integrity constraint). I'm using Oracle 8i. > > My question, therefore, is: > > Do I have to perform my own referential integrity checks when I use > OJB? Am I missing a basic idea behind OJB (like the lack of a need for > referential integrity)? > > I've searched the mail archives and the online docs, but can't find the > answer to these simple questions. > > Thanks, > > Anthony Carlos > > > --------------------------------------------------------------------- > 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]
