RE: Using null value with FK

2003-07-10 Thread Charles Anthony
Hi Vincent,

If the attribute that the column represents is an int i.e. the java
primitive, OJB cannot directly assign it a value of null.

The simplest solution for this is to not use primitives as attributes if
they can be null.

If you really want/need to keep the attribute as a primitive, you will have
to use a FieldConversion. see
http://db.apache.org/ojb/jdbc-types.html for more information. 

Cheers,

Charles.

-Original Message-
From: Vincent Frison [mailto:[EMAIL PROTECTED]
Sent: 09 July 2003 22:30
To: OJB Users List
Subject: Using null value with FK


Hi,

I've read somewhere in this ML that, since the latest 
releases, OJB uses
null values for FK when the referenced object is null. But it doesn't,
it uses the default 0 value instead (the FK is a int). Note that my FK
field descriptor is defined with the nullable attribute.

This is really annoying since it isn't compatible with the FK 
constraint
of my DB (PostgreSQL). So I guess I've misunderstood a basic concept..

Vincent

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



RE: Using null value with FK

2003-07-10 Thread Vincent Frison
Le jeu 10/07/2003 à 08:36, Charles Anthony a écrit :
 Hi Vincent,
 
 If the attribute that the column represents is an int i.e. the java
 primitive, OJB cannot directly assign it a value of null.
 
 The simplest solution for this is to not use primitives as attributes if
 they can be null.

Thanks Charles, just convert my int to Integer, and it's ok now.

 If you really want/need to keep the attribute as a primitive, you will have
 to use a FieldConversion. see
 http://db.apache.org/ojb/jdbc-types.html for more information. 

I'm easily too lazy for do my own FieldConversion, so I think I'll keep
the Integer for my FKs! ;p But it's a shame that null values are not
supported with primitives, not at the Java level of course, but I really
think that OJB could automatically do the trick.. 

-- 

Vincent Frison |   Ohm Force
System Administrator   |  Digital Audio Software
mailto:[EMAIL PROTECTED] | http://www.ohmforce.com


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



Using null value with FK

2003-07-09 Thread Vincent Frison
Hi,

I've read somewhere in this ML that, since the latest releases, OJB uses
null values for FK when the referenced object is null. But it doesn't,
it uses the default 0 value instead (the FK is a int). Note that my FK
field descriptor is defined with the nullable attribute.

This is really annoying since it isn't compatible with the FK constraint
of my DB (PostgreSQL). So I guess I've misunderstood a basic concept..

Vincent

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