on 2012 May 04 10:05 AM
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.NHibernateRepository
1.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.Dictionary
2.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:
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.