The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hi,

In addition to my previously posted question

http://sqlanywhere-forum.sap.com/questions/11380/nhibernate-issue-with-parameters

There seems to be a possible related issue with named query parameters. I have tried very simple query examples with a parameter and the following rig: NHibernate-3.3.0.GA, SybaseSQLAnywhere12Driver, SybaseSQLAnywhere12Dialect, and iAnywhere.Data.SQLAnywhere.v4.0. It is worth noting that this same error also occurs with NHibernate-3.3.0.CR1:

NHibernate.Exceptions.GenericADOException was unhandled Message=could not execute query [ select fxir. into #FX_RATE from FX_RATE fxir inner join (select FromCcy, ToCcy, Source, max(effDate) maxEffDate from FX_RATE where Status <> 'EXCEPTION' and EffDate <= ? and Type = 0 group by FromCcy, ToCcy, Source) C on C.FromCcy = fxir.FromCcy and C.ToCcy = fxir.ToCcy and C.Source = fxir.Source and C.maxEffDate = fxir.EffDate where fxir.Type = 0 and fxir.Status <> 'EXCEPTION' and fxir.Version = (select max(fx2.Version) from FX_RATE fx2 where fx2.ID = fxir.ID) ] Positional parameters: #0>5/4/2012 9:10:39 AM [SQL: select fxir. into #FX_RATE from FX_RATE fxir inner join (select FromCcy, ToCcy, Source, max(effDate) maxEffDate from FX_RATE where Status <> 'EXCEPTION' and EffDate <= ? and Type = 0 group by FromCcy, ToCcy, Source) C on C.FromCcy = fxir.FromCcy and C.ToCcy = fxir.ToCcy and C.Source = fxir.Source and C.maxEffDate = fxir.EffDate where fxir.Type = 0 and fxir.Status <> 'EXCEPTION' and fxir.Version = (select max(fx2.Version) from FX_RATE fx2 where fx2.ID = fxir.ID)] Source=NHibernate SqlString=select fxir.* into #FX_RATE from FX_RATE fxir inner join (select FromCcy, ToCcy, Source, max(effDate) maxEffDate from FX_RATE where Status <> 'EXCEPTION' and EffDate <= ? and Type = 0 group by FromCcy, ToCcy, Source) C on C.FromCcy = fxir.FromCcy and C.ToCcy = fxir.ToCcy and C.Source = fxir.Source and C.maxEffDate = fxir.EffDate where fxir.Type = 0 and fxir.Status <> 'EXCEPTION' and fxir.Version = (select max(fx2.Version) from FX_RATE fx2 where fx2.ID = fxir.ID) StackTrace: at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 1573 at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 1472 at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet1 querySpaces, IType[] resultTypes) in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Loader\Loader.cs:line 1467 at NHibernate.Loader.Custom.CustomLoader.List(ISessionImplementor session, QueryParameters queryParameters) in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Loader\Custom\CustomLoader.cs:line 276 at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results) in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Impl\SessionImpl.cs:line 2098 at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters, IList results) in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Impl\SessionImpl.cs:line 2081 at NHibernate.Impl.SessionImpl.List[T](NativeSQLQuerySpecification spec, QueryParameters queryParameters) in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Impl\SessionImpl.cs:line 2067 at NHibernate.Impl.SqlQueryImpl.List[T]() in C:\OpenSource\NHibernate-3.3.0.GA-src\src\NHibernate\Impl\SqlQueryImpl.cs:line 163 at SwapExtractDAL.NHibernate.Repositories.NHibernateRepository1.GetNamedQueryResultsDateTimeParam(String queryname, DateTime dt) in C:DevelopmentTestSwapExtractGenerator_02SwapExtractDALNHibernateRepositoriesNHibernateRepository.cs:line 93 at SwapExtractBLL.SwapCommonFileExtraction.GetFxRate() in C:DevelopmentTestSwapExtractGenerator_02SwapExtractBLLSwapCommonFileExtraction.cs:line 71 at SwapExtractBLL.SwapCommonFileExtraction..ctor() in C:DevelopmentTestSwapExtractGenerator_02SwapExtractBLLSwapCommonFileExtraction.cs:line 19 at SwapExtractGenerator_02.Program.Main(String[] args) in C:DevelopmentTestSwapExtractGenerator_02SwapExtractGenerator_02Program.cs:line 27 InnerException: System.ArgumentNullException Message=Value cannot be null. Parameter name: key Source=mscorlib ParamName=key StackTrace: at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.ContainsKey(TKey key) at Iesi.Collections.Generic.DictionarySet`1.Add(T o) in c:Usersoskar.berggrenDocumentsProjectsnhibernate-core-3srcIesi.CollectionsGenericDictionarySet.cs:line 57 at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateAdoNetAbstractBatcher.cs:line 245 at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 1224 at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 421 at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 251 at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in C:OpenSourceNHibernate-3.3.0.GA-srcsrcNHibernateLoaderLoader.cs:line 1564 InnerException:

asked 04 May '12, 09:05

waynemystir's gravatar image

waynemystir
16223
accept rate: 0%


I would disagree that the above is a "simple" example, at least with respect to NHibernate. What problem determination have you done? All of these exceptions appear to be within NHibernate - have you tried to determine what the reason is behind the "cannot execute query" exception in Visual Studio? Does a simpler named query with a single parameter work?

permanent link

answered 04 May '12, 09:22

Glenn%20Paulley's gravatar image

Glenn Paulley
10.7k568104
accept rate: 43%

Hi Glen. I meant that I have tried simple queries, in addition to the one I have posted. It is defintely not an issue with Visual Studio. And yes, I have tried a painfully simple query, with the same exact result.

(04 May '12, 09:25) waynemystir
Replies hidden

I didn't mean the problem was with Visual Studio. I meant - have you debugged a simple Criteria query through the VS debugger with a debug build of NH3.3.0?

(04 May '12, 09:34) Glenn Paulley

Yes, using the simple Criteria query posted in my other question, I followed the entire progression through NH. It does in fact appear to send the query that is logged. I did not do this for the named query issue, as they appear to be closely related and it is rather time consuming.

(04 May '12, 09:38) waynemystir

However, I should note again that I am new to NH and my debug walk-through may not have revealed a problem there.

(04 May '12, 09:41) waynemystir
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×8

question asked: 04 May '12, 09:05

question was seen: 2,652 times

last updated: 04 May '12, 09:41