Hello
We user nhibernate 3.1.0.4000 and when a proxy of an entity is passed as
parameter to an HQL query nhibernate throws the exception: Could not
execute query[SQL: SQL not available]
For example: Session.CreateQuery("select count(user) from users as user
where user.Chef = :chef").SetEntity("chef",user.Chef).UniqueResult()
Shouldn't those proxy entities disappear when you access them? The problem
is that those proxy entities are appearing everywhere in the application:
- As result of hql queries
- As property of other entities, which should be lazy loaded
- Inside entities collections, which should be lazy loaded
Is this the effect of nhibernate 2nd level cache?
If we unproxy the entity it works:
Session.GetSessionImplementation().PersistenceContext.Unproxy(user.Chef)
But we have many hql queries with entities as parameters and we don't want
to add unproxy code everywhere.
Is this a bug? Is there a solution?
Thanks
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/Ccy-d_91mJgJ.
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.