-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Question: bit operation in HQL
PostPosted: Tue Jul 04, 2006 11:50 pm 
Newbie

Joined: Tue Jul 04, 2006 11:21 pm
Posts: 1
Hi, guys,

I have a user object which has a bit-stored privacy attribute.
When I justify whether a user has a proper privacy I could use 'user.privacy& SOME_PRIVACY '.
So I can get all the user has the privacy 16 in mysql database by 'SELECT * FROM user where privacy&16 <>0', My Question is how could I do the same thing in HQL form.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 1:16 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Pass in the log base 2 (so for 16, you'd pass in 4, for 1024, pass in 10), then use "mod(user.privacy / :LOG_PRIVACY ) = 1".

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.