db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCutcheon <michaelm...@frontiernet.net>
Subject Derby with beans and null primitives
Date Wed, 30 Nov 2005 05:28:42 GMT
I'm implementing a utility class that populates 'beans' with data from 
tables in derby.  Suppose I have the following 'bean':

public class Person
{
  private String firstName;
  private String lastName;
  private int weight;
 
  public void setWeight(int inWeight)
  {
    this.weight = inWeight;
  }
  public int getWeight()
  {
    return this.weight;
  }
}

I select out of a Person table to get the information to populate this bean.

But what happens if weight is nullable in the table?

Since you can't put nulls into primitives in Java, how is this handled? 

This is a real problem because 0 is definately different than no value.

Also is there some standard for how JSP's deal with beans with primitive 
types?

How should null primitives be handled in beans like this?

Thanks

Mike


Mime
View raw message