Hi Dirk,

Can you post the relevant DDL and repository?  Is the person-activity relation defined 
as a non-decomposed m-n relation?  I suspect you have a constraint set in the DDL that 
prevents the relation from being stored.  As far as the 0 is concerned, do you use a 
primitive int or an Integer object to store your PK?  If you use a primitive, a zero 
is the default value that OJB will interpret as null.

Good luck,

Wally Gelhar
  
-----Original Message-----
From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 4:54 AM
To: 'OJB Users List'
Subject: AW: integrity constraint violation 
Sensitivity: Personal


Hi there,

can anyone give me a hint about my problem (see below)? if I have the following two 
tables

*************************************************************** *
***************************************************************** 
* Table PERSON                                          *
* Table ACTIVITY                                                *
*-------------------------------------------------------------------------
* _0..1________N_       * -----------------
---------------------------------------------------------       *
* personId INTEGER NOT NULL Identity Primary Key        *
*  activityId INTEGER NOT NULL Identity Primary Key     *
* ....                                                          *
*  personId INTEGER (foreign key)                               *
        
*    ...                                                                *

with a 0..1-to-many relation. both tables are empty. it should be possible to create 
an activity and store it without assigning a person, right?! However I get a violated 
constraint exception for table PEERSON, although I did not setup any value for 
personId as no row exists in table person. after traced the exception message I found 
out, that for the attribute person_id OJB generated a 0 value and tries to store it 
and I just read in another message that there is a 0-null problem for OJB. Am I facing 
exact this problem?

help appreciated!

thx,
Dirk


 

-----Urspr�ngliche Nachricht-----
Von: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 7. Januar 2004 18:56
An: [EMAIL PROTECTED]
Betreff: integrity constraint violation 



Hi,
 
I have got a problem with referential integrity. I am using OJB PB API with HSQLDB and 
have set up a table 'person' with personId as primary key and a second table 
'activity' with this attribute as foreign key (null allowed). the datatyp is integer 
and the association is 0..1 to many. 
 
It should be possible to store an activity and assign a person later to it. however, 
when I try to store an activity I get the following exception:
 
org.apache.ojb.broker.KeyConstraintViolatedException ....
java.sql.SqlException: integrity constraint violation for table 'person'. What am I 
doing wrong?
 
thx,
Dirk
 


---------------------------------------------------------------------
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]

Reply via email to