We are using PostgreSQL 7.0.2 and it's corresponding JDBC driver (also
version 7.0.2). Any clues would be appreciated. For what it's worth, here is
the work-around code I had to write in my CMP bean to properly handle nulls.
In this table, "id_affiliate" is an integer field which allows nulls; it is
a foreign key reference; a byproduct of this is that "zero" is an invalid
value; so, I write code in ejbLoad which tests for zero, and if so, sets it
to null for proper handling later.

    Integer    id_affiliate;

    public void ejbLoad() throws javax.ejb.EJBException,
java.rmi.RemoteException {
        if ((id_affiliate != null) && (id_affiliate.intValue() == 0))
id_affiliate = null;
    }


Help please! Thank you,

Bryan



----- Original Message -----
From: "Vandome G�rard" <[EMAIL PROTECTED]>
To: "Bryan Field-Elliot" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 28, 2000 8:35 AM
Subject: Re: NULL Integer being set to 0 in CMP bean?


>
>
> > Bryan Field-Elliot wrote:
> >
> > I am using Jonas 2.
> > I have a CMP entity bean.
> > One of the columns is of type "int".
> > This column allows nulls, so in my CMP bean, I represent it as an
> > "Integer" object rather than an "int" primitive.
> > Whenever Jonas loads a row into an entity bean, if the column contains
> > NULL, then my Integer member variable is set to an Integer object of
> > value "0", rather than just leaving it as NULL.
> >
> > Question: Is this behavior intentional, or a bug? How can I make sure
> > that if the column is null, then my member variable Integer reference
> > is also null?
>
> Strange, because it should work as you mention (the field is null if the
> column contains NULL). Can you please indicate which database and jdbc
> driver your are using, as it can be a jdbc driver problem?
>
> --
> G�rard Vandome    Evidian
> [EMAIL PROTECTED] phone: 33 4 76 29.75.67
> http://www.objectweb.org      http://www.evidian.com

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to