Re: Postgresql + booleans = error
Re: Postgresql + booleans = error
- Subject: Re: Postgresql + booleans = error
- From: "WebObjects" <email@hidden>
- Date: Mon, 20 Feb 2006 12:16:39 +0100
Hello,
I dont know if you solved this problem or didnt yet.
However, this is the solution.
The EOModeler translates a bool to Number as you explained.
The simplest solution, you change the Number into Boolean for the setter
and
the getter, this solves the problem.
The next time you generate the Class you have to do the same again.
The best solution you use eogenerator. This tool translates the class
correctly and does the job well.
pea Sako e
>
> ----- Original Message -----
> From: "shaun" <email@hidden>
> To: "Lachlan Deck" <email@hidden>
> Cc: "WebObjects Dev" <email@hidden>
> Sent: Saturday, February 18, 2006 3:16 AM
> Subject: Re: Postgresql + booleans = error
>
>
> > 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
> >
> >
>
_______________________________________________
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