Hello
We use nhibernate v. 3.1.0.4000 and when in a HQL queries the parameter is
a proxy of an entity 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()
The problem is that nhibernate returns those proxied entitites and now they
are popping everywhere in the application.
They come as result of HQL queries, as properties of other entities (lazy
load), inside entities collections (lazy load).
Is this the effect of the nhibernate 2nd level cache?
If we unproxy the entities the HQL query works, but we have many of them
and we don't want to add unproxy code everywhere.
Is this a bug of nhibernate or not? How can it be fixed?
Message: Could not execute query[SQL: SQL not available]
Stacktrace: at NHibernate.Impl.SessionImpl.List(String query,
QueryParameters queryParameters, IList results)
at NHibernate.Impl.SessionImpl.List(String query, QueryParameters
parameters)
at NHibernate.Impl.QueryImpl.List()
at NHibernate.Impl.AbstractQueryImpl.UniqueResult()
InnerException: Castle.Proxies.UserProxy
Stacktrace
at NHibernate.Type.EntityType.ToLoggableString(Object value,
ISessionFactoryImplementor factory)
at NHibernate.Impl.Printer.ToString(IDictionary`2 namedTypedValues)
at
NHibernate.Engine.QueryParameters.LogParameters(ISessionFactoryImplementor
factory)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters
queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(String query, QueryParameters
queryParameters, IList results)
--
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/-/lmQkydTX3p8J.
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.