Re: Automatic boolean conversion?

Jonathan Rochkind <[email protected]> Mon, 14 Apr 2003 10:56:18 -0500
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
I haven't run into the exact problem you mention, but I have run into other 
problems where EOF's 'automatic' boolean conversion creates seriously 
annoying problems for me. I wish there was a way to turn it on and off.

My alternative is to have the actual model attribute have a different name 
than the method in Java code. Since they have different names, EOF doesn't 
discover that you meant to convert it to boolean, so doesn't do the 
conversion for you. You can do the conversion yourself however you want in 
your method implementation. That's worked for me.

--Jonathan

At 10:02 AM 4/11/2003 -0400, Jesse Barnum wrote:
>I'm trying to deal with Boolean values stored in the database. In 5.2, if 
>I write a custom accessor method that returns a type 'boolean', then 
>presto! 5.2 automatically internally converts the '1' or '0' from the 
>database (I'm storing as an integer in the db) into a boolean.
>
>However, this 'feature' introduces a problem - the stored snapshot from 
>the database contains the value '1' (I guess the conversion happens after 
>that point), and whenever I save changes to the database, EOF thinks that 
>that attribute has changed from '1' to 'true', and it writes this to the 
>database, even when this is not necessarily appropriate.
>
>Has anybody else run into this? Any suggestions?
>
>--Jesse Barnum, CEO, 360Works
>http://www.360works.com/
>Try WooF, the only solution for linking WebObjects and FileMaker!
>
>_______________________________________________
>EOF mailing list
>[email protected]
>http://www.omnigroup.com/mailman/listinfo/eof