For testing plain selects, you should use Create*SQL*Query, otherwise NH treats your query as HQL.
2016-03-22 18:40 GMT+01:00 Steve Lyle <ssl...@gmail.com>: > Also. My record set has no being persisted. So so there will not be any > inserts or updates from this records set taken against the database. > > > On Monday, March 21, 2016 at 8:20:46 PM UTC-4, Steve Lyle wrote: > >> My application calls and successfully receives a result set from my >> database. >> When I look in the log4net file I can even see the values of each field >> of each row returned because the values are logged as DEBUG messages in the >> log file. >> >> *But at the end of receiving the rows hbm fails complaining - from the >> log at the failure:* >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'VRM' as column: col_6_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'Flash freeze' as column: col_7_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.Int32Type - returning >> '14' as column: col_8_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'steve2' as column: col_9_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'steve2' as column: col_10_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'steve2' as column: col_11_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> 'steve2' as column: col_12_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.DateTimeType - >> returning null as column: col_13_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.Int32Type - returning >> null as column: col_14_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Type.StringType - returning >> null as column: col_15_0_ >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Loader.Loader - done >> processing result set (35 rows) >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.Driver.NHybridDataReader - >> running NHybridDataReader.Dispose() >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - >> Closed IDataReader, open IDataReaders :0 >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - >> DataReader was closed after 32 ms >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.AdoNet.AbstractBatcher - >> Closed IDbCommand, open IDbCommands: 0 >> 2016-03-21 14:36:49,820 [11] DEBUG NHibernate.AdoNet.ConnectionManager - >> aggressively releasing database connection >> 2016-03-21 14:36:49,820 [11] DEBUG >> NHibernate.Connection.ConnectionProvider - Closing connection >> 2016-03-21 14:36:49,820 [11] DEBUG >> NHibernate.Engine.StatefulPersistenceContext - initializing non-lazy >> collections >> 2016-03-21 14:36:49,840 [11] DEBUG NHibernate.Util.ADOExceptionReporter - >> Could not execute query >> [ SQL not available ] >> >> System.NullReferenceException: Object reference not set to an instance of >> an object. >> at lambda_method(Closure , Object[] ) >> at NHibernate.Linq.ResultTransformer.TransformTuple(Object[] tuple, >> String[] aliases) >> at NHibernate.Hql.HolderInstantiator.Instantiate(Object[] row) >> at NHibernate.Loader.Hql.QueryLoader.GetResultList(IList results, >> IResultTransformer resultTransformer) >> at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor >> session, QueryParameters queryParameters) >> at NHibernate.Loader.Loader.List(ISessionImplementor session, >> QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) >> at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, >> QueryParameters queryParameters) >> at >> NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor >> session, QueryParameters queryParameters) >> at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters >> queryParameters, ISessionImplementor session, IList results) >> at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, >> QueryParameters queryParameters, IList results) >> 2016-03-21 14:36:49,843 [11] WARN NHibernate.Util.ADOExceptionReporter - >> System.NullReferenceException: Object reference not set to an instance of >> an object. >> at lambda_method(Closure , Object[] ) >> at NHibernate.Linq.ResultTransformer.TransformTuple(Object[] tuple, >> String[] aliases) >> at NHibernate.Hql.HolderInstantiator.Instantiate(Object[] row) >> at NHibernate.Loader.Hql.QueryLoader.GetResultList(IList results, >> IResultTransformer resultTransformer) >> at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor >> session, QueryParameters queryParameters) >> at NHibernate.Loader.Loader.List(ISessionImplementor session, >> QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) >> at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, >> QueryParameters queryParameters) >> at >> NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor >> session, QueryParameters queryParameters) >> at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters >> queryParameters, ISessionImplementor session, IList results) >> at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, >> QueryParameters queryParameters, IList results) >> 2016-03-21 14:36:49,843 [11] ERROR NHibernate.Util.ADOExceptionReporter - >> Object reference not set to an instance of an object. >> 2016-03-21 14:37:02,383 [11] DEBUG NHibernate.AdoNet.ConnectionManager - >> after autocommit >> >> >> >> >> *This is the query of the view the 35 rows come from:* >> create view vCustomersServicesSets >> as >> >> select >> ROW_NUMBER() OVER(ORDER BY aa.ServiceRecid DESC) AS >> 'CustomerServiceSetRecid' <-- is this something nHibernate can't deal >> with? And if so what can be done? >> .... >> , bb.ModifiedByName >> from >> ( >> select >> a.ServiceRecid >> ..... >> , b.CustomerEnabled >> from vServices a >> , vCustomers b >> ) aa >> left join ...... >> go >> >> >> >> >> >> *This is my class from the embedded mapping:* >> <class name ="vCustomersServiceOptions" >> table="dbo.vCustomersServicesSets" dynamic-update="true"> >> <cache usage="read-only"/> >> <id name="CustomerServiceSetRecid" column="CustomerServiceSetRecid" >> type="int"> >> <generator class="native" /> >> </id> >> <property name="DataEntryRowDisabled" /> >> ....... >> <property name="ModifiedByName" /> >> </class> >> >> >> *What do I do?* >> > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nhusers+unsubscr...@googlegroups.com. > To post to this group, send email to nhusers@googlegroups.com. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+unsubscr...@googlegroups.com. To post to this group, send email to nhusers@googlegroups.com. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.