You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by David McReynolds <dm...@secureworks.com> on 2008/11/14 15:24:10 UTC

bitmap fields

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

RE: bitmap fields

Posted by David McReynolds <dm...@secureworks.com>.
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.

Larry


On Fri, Nov 14, 2008 at 7:24 AM, David McReynolds
<dm...@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

Re: bitmap fields

Posted by Larry Meadors <la...@gmail.com>.
I don't know. :)

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

Larry


On Fri, Nov 14, 2008 at 7:24 AM, David McReynolds
<dm...@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