Reputation: 430
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....
Upvotes: 4
Views: 9038
Reputation: 430
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();
Upvotes: 5