ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Model has int but database is a Number
Date Sun, 20 Aug 2006 03:10:14 GMT
You didn't say this, but I think it is implied: The database field can
be null, correct?

If the value can contain null, and null means something other than 0,
then you have no rational choice but to use an Integer.

IMO, using an int and a boolean to do this is a really bad idea. Bad
enough that if someone on my team did that, I'd consider letting them
go.

Can you use JDK5? That would make the entire conversation moot - you'd
just use Integer, and treat it like an int in your code:

  Integer prop = 5; // where's the new()?
  prop++; // prop is now 6

Larry


On 8/19/06, Mississippi John Hurt <johnhurt@gmail.com> wrote:
> What's the best way to handle this? My db column is a NUMBER where 0 has
> meaning, so does 1.
> My model has a property that's an int. But int's by default are 0 (which
> have meaning). So my dynamic map statement cannot tell if the int value of 0
> is set by me or by default 0. So other than having another say java boolean
> indicator, how can I get around this best? Other than making the property a
> Integer object which will force me to add extra java code everywhere to
> convert from int to Integer?  Thanks.
>

Mime
View raw message