Hi,

I believe it is possible *only* if you do not use a primitive to hold the
primary key.

In order to assign primary keys, OJB need to know if an object needs a key.
If the key is stored as an Object e.g. Long, Integer, BigInteger etc then it
checks to see if the attribute is null. If, however, they is a primitive
e.g. int or long, the only way OJB can see if the object does not have a key
is to check for a specific, arbitrary number. The number OJB currently looks
for is zero. 

It *is* possible to have a nullable foreign key, but again *only* if the
foreign key is not a primitive. Primitives *always* have a value, therefore
the foregin key will always have a value.

HTH,

Cheers,

Charles.

>-----Original Message-----
>From: Danilo Tommasina [mailto:[EMAIL PROTECTED]
>Sent: 04 August 2003 08:08
>To: OJB Users List
>Subject: Question on Primary Keys
>
>
>Hi,
>
>since nobody answered my previous posts, i'll try to simplfy 
>my questions :)
>Is it possibile with OJB (rc4) to use numeric primary key with 
>value = 0?
>Is it possible to use a nullable foreign key (optional 
>reference) that references an other table's primary key with value = 0?
>
>If your answer is YES, then there is a bug, if your answer is 
>NO then i'd like to know why it should not be possible
>and i'll have to run tons of SQL scripts for 'correcting' my 
>existing data :(
>
>thanks and bye
>danilo
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.

 At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk.  All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to 
HPD Software Limited or its affiliates.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to