The Oracle error is: ORA-02291 integrity constraint (%s.%s) violated - parent key not found
The constraint referenced in my case is an optional foreign key 'FOREIGN KEY (ACTDATA) REFERENCES ACTIVITIES (ID)' on table PROPERTIES. The ddl is following (i ommited all fields that i think are not relevant here) CREATE TABLE RESOURCES ( ID INTEGER, ... PRIMARY KEY (ID) ); CREATE TABLE ACTIVITIES ( ID INTEGER, ... PRIMARY KEY (ID) ); CREATE TABLE CARDS ( ID INTEGER, ... PRIMARY KEY (ID) ); CREATE TABLE PROPERTIES ( IDA INTEGER, ... RESDATA INTEGER, ACTDATA INTEGER, CARDPROPERTIES INTEGER, PRIMARY KEY (IDA), FOREIGN KEY (RESDATA) REFERENCES RESOURCES (ID), FOREIGN KEY (ACTDATA) REFERENCES ACTIVITIES (ID), FOREIGN KEY (CARDPROPERTIES) REFERENCES CARDS (ID), ); and the repository.xml extract for the preceding tables is: <class-descriptor class="com.optitime.api.datamodel.entity.Resource" table="resources"> <field-descriptor name="id" column="id" jdbc-type="INTEGER" primarykey="true"/> ... <collection-descriptor name="data" element-class-ref="com.optitime.api.datamodel.entity.Property" auto-update="true" auto-retrieve="true" auto-delete="false"> <inverse-foreignkey field-ref="resdata"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.optitime.api.datamodel.entity.Activity" table="activities"> <field-descriptor name="id" column="id" jdbc-type="INTEGER" primarykey="true"/> ... <collection-descriptor name="data" element-class-ref="com.optitime.api.datamodel.entity.Property" auto-update="true" auto-retrieve="true" auto-delete="false"> <inverse-foreignkey field-ref="actdata"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.optitime.api.datamodel.entity.Card" table="cards"> <field-descriptor name="id" column="id" jdbc-type="INTEGER" primarykey="true"/> ... <collection-descriptor name="properties" element-class-ref="com.optitime.api.datamodel.entity.Property" auto-update="true" auto-retrieve="true" auto-delete="false"> <inverse-foreignkey field-ref="cardproperties"/> </collection-descriptor> </class-descriptor> The DDL is generated and contains only primary keys and foreign keys, so all constraints should be known by OJB. -----Message d'origine----- De : Oleg Nitz [mailto:[EMAIL PROTECTED] Envoyé : mardi 13 janvier 2004 12:26 À : OJB Users List Objet : Re: Batch mode and foreign keys Hi Guillaume, Please translate the text of the exception into English and give more details about this case. Is GNT the name of the table? What are related objects for GNT involved into this thansaction? And the most important question is: Do all database constraints correspond to some relations described in repository.xml? If there is some database constraint that OJB is not aware of, it might be violated with the batch mode, because OJB changes the order of statements to group them into batches, but in such way that doesn't violate *known* constraints. Regards, Oleg On Tuesday 13 January 2004 08:07, Guillaume Nodet wrote: > Hi ! > > I've got a problem with RC5. > I use the broker api to store several objets with collections and nested > objets. > Under certain circumstances (Oracle, batch mode), i've got the following > exception thrown: > > java.sql.SQLException: ORA-02291: violation de contrainte > (GNT.SYS_C00194175) d'integrite - touche parent introuvable > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java) > at oracle.jdbc.ttc7.Oall7.receive(Oall7.java) > at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java) > at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java) > at > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java) at > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java) at > oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedState >m ent.java) > at > org.apache.ojb.broker.platforms.PlatformDefaultImpl.executeBatch(Unknown > Source) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecu >t e(Unknown Source) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke( >U nknown Source) > at $Proxy0.doExecute(Unknown Source) > at org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown > Source) > at org.apache.ojb.broker.util.batch.BatchConnection.commit(Unknown Source) > at > org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localCommit(Unknown > Source) > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknown > Source) > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un >k nown Source) > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un >k nown Source) > at > com.optitime.synchronizer6.Synchronizer.initTables(Synchronizer.java:826) > at > com.optitime.synchronizer6.SynchronizerApplication$ActionThread.run(Synchro >n izerApplication.java:1021) > > When I set batch mode to false, or when i commit the transaction between > each stored objects, i've got no problem. > > Has anyone an idea ? > > Guillaume Nodet. > > > > > > > --------------------------------------------------------------------- > 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]