How to query flags stored as enum in NHibernate

Posted by SztupY on Stack Overflow See other posts from Stack Overflow or by SztupY
Published on 2010-05-10T19:10:36Z Indexed on 2010/05/10 19:14 UTC
Read the original article Hit count: 788

Filed under:
|
|
|
|

How to do either a HQL or a Criteria search (the latter is preferred) involving an enum that is used as flags. In other words, I have a persisted enum property that stores some kind of flags. I want to query all the records that have one of these flags set. Using Eq won't work of course because that will only be true, if that is the only flag set.

Solving this using the Criteria API would be the best, but if this is only doable using HQL that is good too.

© Stack Overflow or respective owner

Related posts about c#

Related posts about criteria