YES! Worked like a charm. Thank you very much!
 

-----Original Message-----
From: Thomas Mahler [mailto:[EMAIL PROTECTED]
Sent: Friday, February 21, 2003 4:39 PM
To: OJB Users List
Subject: Re: nullable integer fields


Hi David,

You'll have to use the Int2IntegerFieldConversion on your Integer 
attribute. This will convert 0 into null on saving!

Details on FieldConversions in jdbc-types.html

cheers,
Thomas

David Mitchell wrote:
>  I have a table with some foreign key columns defined as integer,
nullable. 
> 
>  Unfortunately, since OJB has mapped my integer columns to "int" values in
> Java, I have no way to set a null value on the field!  In other words, I
> create a new instance of an object, I dont set a value for the null field,
> but when I do "save", it blows up because OJB is trying to set the column
to
> 0, and not null.
> 
>  I tried, as an experiment, changing the definitions to Integer from int,
> but OJB doesnt appear to like it, and is setting each column to null and
> ignoring the columns that actually HAVE a value. im assuming its because
of
> the INTEGER jdbc-column type set in the repository, perhaps not mapping to
> the correct setter and getters for the jdbc code.
> 
>  How can I define an OJB integer column to be nullable, and be able to
> actually use a null value in that column?
> 
>  thanks- 
> David Mitchell
> 
> 
> 
> 
> +---------------------------------------------------------+ 
> This message may contain confidential and/or privileged information.  If
you
> are not the addressee or authorized to receive this for the addressee, you
> must not use, copy, disclose or take any action based on this message or
any
> information herein.  If you have received this message in error, please
> advise the sender immediately by reply e-mail and delete this message.
> Thank you for your cooperation.
> +---------------------------------------------------------+
> 
> ---------------------------------------------------------------------
> 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]


+---------------------------------------------------------+ 
This message may contain confidential and/or privileged information.  If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein.  If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message.
Thank you for your cooperation.
+---------------------------------------------------------+

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

Reply via email to