All,
Trying to use SetLockMode with an IQuery. I don't fully understand
what the alias means (documentation isn't that clear, could do with an
example) but I think it refers to the object being locked.
I have the following statement:
IDomainClassChild child = session.CreateQuery("FROM DomainClassChild
WHERE ChildName = :name")
.SetString("name", "Donna Nobel")
.SetMaxResults(1)
.SetLockMode(string.Empty, LockMode.Upgrade)
.UniqueResult<IDomainClassChild>();
and it fails with an NHibernate ADOException, message is:
could not execute query
[ select domainclas0_.Id as Id1_, domainclas0_.ParentId as ParentId1_,
domainclas0_.ChildName as ChildName1_, domainclas0_.Counter as
Counter1_ from DomainClassChild domainclas0_ where
domainclas0_.ChildName=? ]
Name:name - Value:Donna Nobel
[SQL: select domainclas0_.Id as Id1_, domainclas0_.ParentId as
ParentId1_, domainclas0_.ChildName as ChildName1_,
domainclas0_.Counter as Counter1_ from DomainClassChild domainclas0_
where domainclas0_.ChildName=?]
As far as I can tell, there isn't a lot wrong with the query NH has
produced.
I've also used the LockMode with "DomainClassChild" as the alias
instead of string.Empty, and as the internal NH created reference
"domainclas0" but no difference. If I take out the lock mode, the
query works.
What should this alias be... or how do I use LockMode on an IQuery?
--
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=.