Hi Bryan,

I reproduce your problem using PostgreSQL, but I not be able to
reproduce
it on another database as InstantDB for example.
Moreover, on those two databases, there is no problem to take into
account
the SQL-NULL value in case of the associated bean's field is a String or
a
java.sql.Date.
Indeed, it's depend on the java.sql.ResultSet getting method used
(getObject(), getString(), getDate(), ....).
That's the reason I think this is a PostgreSQL JDBC driver problem.

Nevertheless, I found a solution to turn around this problem.
It will be available in the next version of JOnAS.

Kind regards.
Hélène.

Bryan Field-Elliot wrote:
> 
> 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".

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                       PLEASE, TAKE INTO ACCOUNT MY NEW EMAIL
-=- Hélène JOANIN -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  mailto:[EMAIL PROTECTED]   http://www.evidian.com
  Phone: 33.4.76.29.73.53            Fax: 33.4.76.29.76.00
  Download our EJB Server JOnAS at http://www.objectweb.org
----
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