[1.2.4] Bitwise operator in JPA

939 views
Skip to first unread message

Philip Camilleri

unread,
Jun 30, 2012, 7:42:59 PM6/30/12
to play-fr...@googlegroups.com
hi All,

I'd like to run a very simple using a bitwise where-clause -- e.g. "SELECT something FROM table WHERE (field & 3) = 3"
This is easily done with MySQL, but JPA absolutely doesn't allow "&" in the query. I've been digging around trying to hack away at this, but I keep hitting dead ends.

Any suggestions on how to implement this (for play 1.2.x)?

thanks!
Phil.

eee

unread,
Jul 1, 2012, 9:00:37 AM7/1/12
to play-fr...@googlegroups.com
Ignoring why you would do that...

You will have to use modulo and divisions by 2^n
For your example you could do

field % 4 = 3
Reply all
Reply to author
Forward
0 new messages