views:

909

answers:

1
string query = "update User u set u.PointsTotal = 1 join u.Rounds r where r.RoundId = :round and (r.Row1 & :val) > 0";

NHibernateSession.CreateQuery(query)
    .SetByte("val", (byte)val)
    .SetInt32("round", roundId)
    .ExecuteUpdate();

Just gives me "The given key was not present in the dictionary."

And yes, the relations works as expected, can do selects....

A: 

Ok solved this one, seems like you have to do a subquery...

string query = "update User u set u.PointsTotal = 1 where u.Id in (select u2.Id from User u2 join u2.Rounds r where r.RoundId = :round and (r.Row1 & :val) > 0)";

NHibernateSession.CreateQuery(query)
    .SetByte("val", (byte)val)
    .SetInt32("round", roundId)
    .ExecuteUpdate();
PUT