I would like to execute the following two statements at once with NHibernate HQL:
update CustomFieldValue set Value = :newVal where Key = 1 and Value = :oldVal;
update CustomFieldValue set Value = :newVal where Key = 1 and Value = :oldVal;
I have created one string and try to update it with
var query = this.Session.CreateQuery(hql);
// ... set parameters
query.ExecuteUpdate();
But I always get a QuerySyntaxException. Isn't this possible with NHibernate 3.3.1 or am I doing something wrong?
I'm struggling to understand why you would want to do this? Am I missing it, or are the commands you want to submit to the database identical?
I'm totally guessing here, but are you really trying to do something like:
update CustomFieldValue set Value = :newVal1 where Key = 1 and Value = :oldVal1;
update CustomFieldValue set Value = :newVal2 where Key = 1 and Value = :oldVal2;
It seems to me, that would work?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.