I think the reason you are getting a 0 as a default value for ints is that
this is the Java default for int variables. An int variable cannot have a
value of null! If you want to have null as a default for integer fields then
I believe you will either need to use Integer in your code, or define a
conversion method that will convert an int 0 to null.

Dave Derry


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 23, 2002 4:32 AM
Subject: [PB] probeml with default value when storing data


Hello,

When you store data (store() method) I have seen that OJB put values by
default if you don't assign them.
These default values are:
- "NULL" for varchar, datetime fields
- "0" for int and bit fields

But there is a problem to insert "0" as default integer value.
If you have an integer field which is a foreign key, you should have a
"NULL" value instead of a "0". If you insert a "0" value in the foreign key
field, a "0" value have to be as primary key in the table where the foreign
key is assigned.

What do you think?

Thank you
Sylvain

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



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

Reply via email to