Hi Luka,

I've assigned it to me, but I'm not sure if we can easily fix it (I'll have a chew on it and see if I can come up with anything).

You can use HQL ... this translates to the & operator in SQL Server, however I don't think this is cross-platform because someone has noted in the comments here that Oracle uses the function bitand(): http://216.121.112.228/browse/NH-1192

You could also try the LINQ provider (.Query<>) since it may generate the same HQL syntax and hopefully the same SQL as the HQL parser.

I suspect that the longer-term solution to this may be to add a new function to the Dialect (e.g., bitand) and then implement the 'correct' syntax in each inherited dialect (there doesn't seem to be an SQL standard for this unfortunately).

In the meantime, if you are determined to get this working with QueryOver, I think your best bet is to create a custom SQL Server function and use that. You can register a custom extension method to make the syntax nicer ... for an example have a look at the RestrictionsExtensions here: http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate/Criterion/RestrictionsExtensions.cs?revision=5837&view=markup

.. and the ExpressionProcessor.RegisterCustomMethodCall() method.

Hope that helps.

Richard


-----Original Message----- From: Luka
Sent: Wednesday, May 18, 2011 8:41 AM
To: nhusers
Subject: [nhusers] Re: Bitwise comparison in QueryOver

Ok,
I have created an Issue on jira but don't know how to assign it to
you.
The issue number is: NH-2709

On May 17, 9:57 pm, "Richard Brown \(gmail\)"
<[email protected]> wrote:
If you raise a JIRA and assign it to me I'll take a look.

(Not sure if it will need a custom extension to handle it).







-----Original Message-----
From: Luka
Sent: Tuesday, May 17, 2011 3:54 PM
To: nhusers
Subject: [nhusers] Re:Bitwisecomparison in QueryOver

Yes, this works,.
Thanks

We need to Find a simpler way of doing it.

Fabio Maulo, can you help? Please

:-)

On May 9, 6:13 pm, Chris Sano <[email protected]> wrote:
> Hey Luka,

> Try something along those lines:

> .Where(Expression.Gt(Projections.SqlProjection(String.Format("({{alias}}.Ac
> cessMask
> & {0}) as AccessMask", (int)AccessMask.Read), null, null), 0))

> If anyone has a simpler way of writing the above expression, I'd love to
> hear it.

> Let me know how that works for you.
> -cs

> On Mon, May 9, 2011 at 4:46 AM, Luka <[email protected]> wrote:
> > Hi,
> > How to doBitwisecomparison in QueryOver queries?

> > ie how to do this query in queryover
> > var query = from t in Session.Query<Ticket>()
> >                        from ticketUser in t.TicketUsers
> >                        from usersTicketAccess in
> > t.UsersTicketAccess
> >                        join user in Session.Query<User>() on
> > ticketUser.User.Id equals user.Id
> >                        where user.Id == parameters.UserId
> >                              && (usersTicketAccess.AccessMask &
> > AccessMask.Read) > 0
> >                        select t;

> > please help.

> > --
> > You received this message because you are subscribed to the Google
> > Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group athttp://groups.google.com/group/nhusers?hl=en.

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to