Hello,
While trying to use NHibernate with Spring.NET's HibernateTemplate, I have encountered a nasty invalid cast exception due to unsafe cast code in DetachedCriteria.GetExecutableCriteria.
session input parameter is proxied in Spring.NET an cannot be casted to SessionImpl class.
The offending NHibernate code is prone to such casts exceptions in case that the class implementing ISession is not of type SessionImpl. I've searched through entire codebase and this cast is the only of this kind.
NH team please correct the GetExecutableCriteria to work properly.
Code:
/// <summary>
/// Get an executable instance of <c>Criteria</c>,
/// to actually run the query.</summary>
public ICriteria GetExecutableCriteria(ISession session)
{
impl.Session = (SessionImpl)session;
return impl;
}
Regards,
Robert