Closed
Description
First of all, thank you for an awesome ORM. I've been using NHibernate for a couple of years now, awesome stuff.
I just tried to update from Nhibernate 5.2.7 to 5.3.0 when I noticed a behavior change when running all our unittests. It seems to happen if you use future in combination with fetch and join. I've read thru the release notes and I can't seem to find anything about this.
[Test]
public void Cannot_use_future_with_fetch_and_join()
{
//Works in NH 5.2.7, not in NH 5.3.
Anstallning aAlias = null; //Employee
Anstallningsperiod apAlias = null; //Employee period
var query = Session.QueryOver(() => aAlias)
.JoinQueryOver(() => aAlias.Anstallningsperioder, () => apAlias)
.Fetch(SelectMode.Fetch, () => aAlias.TidgruppDateRanges)
.Future<Anstallning>();
var execute = query.ToList(); //Throws System.InvalidCastException : unable to cast object of type Flex.Net.Domain.Entities.Anstallning to type System.Object[].
/*
Stacktrace:
--InvalidCastException
at NHibernate.Cache.QueryCacheResultBuilder.AddRow(Object result, Object[] entities, IPersistentCollection[] collections)
at NHibernate.Loader.Loader.GetRowFromResultSet(DbDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray,
EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies, IResultTransformer forcedResultTransformer,
QueryCacheResultBuilder queryCacheResultBuilder, Action`2 cacheBatchingHandler)
at NHibernate.Multi.QueryBatchItemBase`1.ProcessResultsSet(DbDataReader reader)
at NHibernate.Multi.QueryBatch.ExecuteBatched()
*/
Assert.That(execute.Count, Is.EqualTo(1));
}
if needed I can provide a minimal example application but I think the test above will be sufficent.
Thanks in advance!