• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Postgresql + booleans = error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Postgresql + booleans = error


  • Subject: Re: Postgresql + booleans = error
  • From: shaun <email@hidden>
  • Date: Sat, 18 Feb 2006 12:46:06 +1030

Hi,

On Sat, 2006-02-18 at 12:53 +1100, Lachlan Deck wrote:
> Hi there,
>
> further to the other's suggestions...
>
> On 16/02/2006, at 2:40 AM, Randall Perry wrote:
>
> > I used eomodeler to generate the model and EO classes from a
> > Postgresql db.
> > I'm having a problem using the boolean data type. If I reference a
> > boolean
> > field 'rec.campsiteFri()' like so:
> >
> > if (rec.campsiteFri()) {
> >             return true;
> >         }
> >
> > I get a compiler error 'incompatible types'.
>
> Of course you do. For these kinds of Java-based errors you need to
> ask yourself:
> The return type of campsiteFri() is:
> 	a) a 'boolean'
> 	b) a 'Boolean'
> 	c) a 'Number'
> 	d) a primitive other than 'boolean'
> 	e) some other Object
>
> You answer will have to be anything other than 'a' because in Java
> (as opposed to C) 'if' statements must take a 'boolean' primitive
> only (or an expression that returns a boolean primitive). Not an int
> or even an Object of type Boolean.
>

I just thought I'd point out that if your using Java 5.0 that you can do
the following:

Boolean b = new Boolean(true);

if (b){
 // its true
}else{
 // its false
}

Yay autoboxing!

regards
 -shaun



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Postgresql + booleans = error (From: Randall Perry <email@hidden>)
 >Re: Postgresql + booleans = error (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Re: Postgresql + booleans = error
  • Next by Date: Re: Efficient qualifier for to-many relationships?
  • Previous by thread: Re: Postgresql + booleans = error
  • Next by thread: Re: Postgresql + booleans = error
  • Index(es):
    • Date
    • Thread