ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David McReynolds <dmcreyno...@secureworks.com>
Subject RE: bitmap fields
Date Fri, 14 Nov 2008 14:40:13 GMT
Dude, don't ask me why. We are introducing java into a C shop. C programmers love bitmaps (I
know, I programmed in C/Unix for 7 years). I think the rational is that it makes the "if"
statements simpler.

Not to worry. After we get through this initial transition, the bitmaps are going to be on
the short list. OTH, I am having a bit of fun extending ibator to handle some of the other
things we must deal with (like primary and secondary databases/datasources.  If I attempt
an operation against the primary and it fails, my dao has to retry against a different database)

In C zero is considered false so you can write stuff like I am about to show you.

        if(0x0044 & foo.getPermission())  . . .

where a java programmer (or more accurately, a non-embedded/non-real-time systems programmer)
would be more likely to write.

     if(foo.isReadableByGroup() && foo.isReadableByOwner())

-----Original Message-----
From: Larry Meadors [mailto:larry.meadors@gmail.com]
Sent: Friday, November 14, 2008 9:29 AM
To: user-java@ibatis.apache.org
Subject: Re: bitmap fields

I don't know. :)

[OT] I am curious why you would do this instead of using multiple named fields.


On Fri, Nov 14, 2008 at 7:24 AM, David McReynolds
<dmcreynolds@secureworks.com> wrote:
> Has anyone used ibator with bitmaps? We've got several bitmaps in various
> tables and so far, I've resorted to writing custom mappings for queries that
> need to interrogate those fields. I'd love to be able to use the generated
> xxxByExample mappings but I have no idea what the criteria would be because
> of the way one has to deal with bit maps (where foo & 8 > 0, for example,
> returns true only if the the 4th bit(2^3) is set).
> --dlm

View raw message