db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Braeuchi" <jbraeu...@gmx.ch>
Subject Re: test cases fail with foreign keys in hsqldb
Date Wed, 04 Dec 2002 21:18:26 GMT
hi all,

the problem with referential integrity is caused by the deletion of all m:n
implemenors when storing m:n relationships:

private void storeCollections(Object obj, Vector vecCds, Map markedForStore)
throws PersistenceBrokerException
{
// get all members of obj that are collections and store all their elements
Iterator i = vecCds.iterator();
while (i.hasNext())
{
CollectionDescriptor cds = (CollectionDescriptor) i.next();
Object col = cds.getPersistentField().get(obj);
if (cds.isMtoNRelation())
{
/* LEANDRO
* Clear all MtoN implementors.
* All new MtoN implementors are going to be added bellow
*/
//logger.info("STORE COLLECTIONS: deleting all MtoN implementors for field
"+cds.getPersistentField().getName());
deleteMtoNImplementor(cds, obj);
}
if (col != null)
{

any ideas ?

jakob

----- Original Message -----
From: "Jakob Braeuchi" <jbraeuchi@gmx.ch>
To: "OJB Developers List" <ojb-dev@jakarta.apache.org>
Cc: "OJB Users List" <ojb-user@jakarta.apache.org>
Sent: Wednesday, December 04, 2002 10:07 PM
Subject: test cases fail with foreign keys in hsqldb


> hi all,
>
> thanks to armin i found that torque does not create the foreign keys
defined
> in -schema.xml when using hsqldb. thanks to these lacking foreign keys our
> test cases pass witout errors... when enabling referential integrity some
> test cases fail:
>
> java.sql.SQLException: Integrity constraint violation: TASK_FK_1 table:
TASK
> in statement [DELETE FROM PERSON_PROJECT WHERE (PROJECT_ID = 1)]
> at org.hsqldb.Trace.getError(Unknown Source)
> ...
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.deleteMtoNImplementor(P
> ersistenceBrokerImpl.java:856)
> ..
> at org.apache.ojb.broker.MtoNMapping.testInsertion(MtoNMapping.java:191)
>
> ....
>
> java.sql.SQLException: Integrity constraint violation: TASK_FK_1 table:
TASK
> in statement [DELETE FROM PERSON_PROJECT WHERE (PROJECT_ID = 2)]
> ..
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.deleteMtoNImplementor(P
> ersistenceBrokerImpl.java:856)
> ..
> at org.apache.ojb.broker.MtoNMapping.testInsertion(MtoNMapping.java:191)
>
> the attached .vm files are the modifications i made to enable referential
> integrity for hsqldb in torque.
> replace those file found in torque.jar sql\base\hypersonic with the ones
> attached. i already sent these files to martin poeschl of torque.
>
> hth
> jakob
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ojb-user-help@jakarta.apache.org>


Mime
View raw message