You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Guillaume Nodet <gu...@deliasystems.com> on 2004/01/13 09:07:22 UTC

Batch mode and foreign keys

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(OraclePreparedStatem
ent.java)
	at org.apache.ojb.broker.platforms.PlatformDefaultImpl.executeBatch(Unknown
Source)
	at
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecut
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(Unk
nown Source)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unk
nown Source)
	at
com.optitime.synchronizer6.Synchronizer.initTables(Synchronizer.java:826)
	at
com.optitime.synchronizer6.SynchronizerApplication$ActionThread.run(Synchron
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Batch mode and foreign keys

Posted by Oleg Nitz <on...@ukr.net>.
Guillaume, I guess I know what's the bug: now only reference-descriptors are 
counted as a source of constraints, and in your case I guess there is only 
collection-descriptor without reference-descriptor in the inverse direction, 
am I right?
I'll fix the bug tonight.

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> 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:on@ukr.net]
> 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(Unknow
> >n 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: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re[2]: Batch mode and foreign keys

Posted by Oleg Nitz <on...@ukr.net>.
Hi Guillaume, 

You may download the source distro from http://db.apache.org/builds/ojb/1.0.rc5/
and get the BatchConnection.java file via web CVS
http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java
(click 'download' by right mouse button and choose "Save Target As")
and then rebuild OJB.

-----Original Message-----
From: "Guillaume Nodet" <gu...@deliasystems.com>
To: "OJB Users List" <oj...@db.apache.org>
Date: Wed, 14 Jan 2004 09:51:33 +0100
Subject: RE: Batch mode and foreign keys

> I can not log on the cvs server.
> What are the right things to do that ?


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


CVS access

Posted by Guillaume Nodet <gu...@deliasystems.com>.
I'm trying to access the cvs server, but i can not figure how to login in.
I tried the following using 'anoncvs' as password:

$ cvs login
Logging in to :pserver:anoncvs@cvs.apache.org:2401/home/cvspublic
CVS password:
cvs [login aborted]: connect to cvs.apache.org(209.237.227.194):2401 failed:
Connection refused

Guillaume



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: Batch mode and foreign keys

Posted by Guillaume Nodet <gu...@deliasystems.com>.
I can not log on the cvs server.
What are the right things to do that ?

Guillaume

-----Message d'origine-----
De : Oleg Nitz [mailto:on@ukr.net]
Envoyé : mercredi 14 janvier 2004 01:29
À : OJB Users List
Objet : Re: Batch mode and foreign keys


Guillaume, can you try now, with CVS version?

Thanks,
 Oleg

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> 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:on@ukr.net]
> 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(Unknow
> >n 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: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: Batch mode and foreign keys

Posted by Guillaume Nodet <gu...@deliasystems.com>.
Thanks a lot !
It works perfectly now.

Guillaume

-----Message d'origine-----
De : Oleg Nitz [mailto:on@ukr.net]
Envoyé : mercredi 14 janvier 2004 01:29
À : OJB Users List
Objet : Re: Batch mode and foreign keys


Guillaume, can you try now, with CVS version?

Thanks,
 Oleg

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> 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:on@ukr.net]
> 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(Unknow
> >n 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: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Batch mode and foreign keys

Posted by Oleg Nitz <on...@ukr.net>.
Guillaume, can you try now, with CVS version?

Thanks,
 Oleg

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> 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:on@ukr.net]
> 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(Unknow
> >n 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: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: Batch mode and foreign keys

Posted by Guillaume Nodet <gu...@deliasystems.com>.
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:on@ukr.net]
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Batch mode and foreign keys

Posted by Oleg Nitz <on...@ukr.net>.
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org