-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: stack trace doing eager join fetching
PostPosted: Wed Jan 02, 2008 5:27 pm 
Newbie

Joined: Wed Jan 02, 2008 4:28 pm
Posts: 1
I'm using NHibernate 2.0, hitting SQL Server 8.00.760. I'm getting the following stack trace, and was hoping someone might know what it means:

NHibernate.ADOException: could not execute query
[SQL: ....sql query is at bottom of the post, since it's verbose... ]
Positional parameters: 0 test report name
0 True
[SQL: ...again, at bottom... ]

at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)
at NHibernate.Impl.SessionImpl.Find[T](CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List[T]()
at ....my code....

System.ArgumentNullException: Value cannot be null.
Parameter name: key

at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at Iesi.Collections.Generic.DictionarySet`1.Add(T o)
at Iesi.Collections.Generic.DictionarySet`1.AddAll(ICollection`1 c)
at NHibernate.Collection.Generic.PersistentGenericSet`1.EndRead(ICollectionPersister persister)
at NHibernate.Impl.SessionImpl.EndLoadingCollections(ICollectionPersister persister, IList resultSetCollections)
at NHibernate.Impl.SessionImpl.EndLoadingCollections(ICollectionPersister persister, Object resultSetId)
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)


-----------

This is part of a large multi-tier application, so I won't post the full source unless you guys need it (the control flow is non-trivial), but here's more or less what I'm trying to do. I have an object:

Package
{
ISet<Report> Reports { get; set; }
}

mapped like so:

<class name="Package" table="dbo.RC_Packages" lazy="false">
<property name="IncludeCRMNote" column="IncludeCRMNote"/>
<set name="Reports" table="dbo.RC_PackageReports" lazy="false" fetch="join">
<key column="PackageID" />
<many-to-many column="ReportID" class="Report"/>
</set>
</class>

The eager join fetching seems relevant b/c when I just go with the default the problem goes away.

Report has a string field "Name." I'm doing a query like so:

DetachedCriteria query = DetachedCriteria.For(typeof(Package));
query.CreateCriteria("Reports").Add(Expression.Eq("Name", "test name"));
packages = query.GetExecutableCriteria(session).List<Package>();

This should fetch back a list containing one package, which has a set containing one report with name "test name"; instead, it fetches back the stack trace. When eager join fetching is turned off, it does do this, so the query and database setup should be okay.


Thanks in advance for helping... Let me know if you'd like more of the source code, the debug output for nhibernate, etc. At this point, I would be happy with a rough sketch of what kinds of problems could possibly lead to this stack trace... I can always take it from there.


--------------

Here's the sql query that's being generated:

SELECT this_.ID as ID2_15_, this_.Version as Version2_15_, this_.IncludeCRMNote as IncludeC3_2_15_, this_.DepartmentID as Departme4_2_15_, this_.Subject as Subject2_15_, this_.Message as Message2_15_, this_.IsActive as IsActive2_15_, this_.UserName as UserName2_15_, reports3_.PackageID as PackageID__17_, report1_.Id as ReportID17_, report1_.Id as Id13_0_, report1_.Version as Version13_0_, report1_.Name as Name13_0_, report1_.DocumentID as DocumentID13_0_, report1_.ClientID as ClientID13_0_, report1_.PortfolioID as Portfoli6_13_0_, report1_.Importance as Importance13_0_, report1_.IsActive as IsActive13_0_, report1_.UserName as UserName13_0_, document5_.Id as Id0_1_, document5_.Version as Version0_1_, document5_.Name as Name0_1_, document5_.Description as Descript4_0_1_, document5_.ClientID as ClientID0_1_, document5_.PortfolioID as Portfoli6_0_1_, document5_.TypeID as TypeID0_1_, document5_.SubTypeID as SubTypeID0_1_, document5_.DueDateID as DueDateID0_1_, document5_.FrequencyID as Frequen10_0_1_, document5_.DepartmentID as Departm11_0_1_, document5_.ManagerID as ManagerID0_1_, document5_.PathTemplate as PathTem13_0_1_, document5_.ReportingEngineID as Reporti14_0_1_, document5_.TemplateID as TemplateID0_1_, document5_.IsActive as IsActive0_1_, document5_.UserName as UserName0_1_, documentty6_.Id as Id19_2_, documentty6_.Name as Name19_2_, documentty6_.Required as Required19_2_, documentty6_.Suffix as Suffix19_2_, documentsu7_.Id as Id12_3_, documentsu7_.TypeID as TypeID12_3_, documentsu7_.Name as Name12_3_, documentsu7_.Required as Required12_3_, documentsu7_.Suffix as Suffix12_3_, documentty8_.Id as Id19_4_, documentty8_.Name as Name19_4_, documentty8_.Required as Required19_4_, documentty8_.Suffix as Suffix19_4_, duedate9_.Id as Id21_5_, duedate9_.Name as Name21_5_, duedate9_.TypeID as TypeID21_5_, duedatetyp10_.Id as Id17_6_, duedatetyp10_.Name as Name17_6_, frequency11_.Id as Id18_7_, frequency11_.Name as Name18_7_, department12_.Id as Id20_8_, department12_.Name as Name20_8_, department12_.ShortName as ShortName20_8_, department12_.Code as Code20_8_, reportinge13_.Id as Id22_9_, reportinge13_.Name as Name22_9_, documentte14_.Id as Id15_10_, documentte14_.Name as Name15_10_, documentte14_.Parameters as Parameters15_10_, documentte14_.ReportingEngineID as Reportin4_15_10_, reportinge15_.Id as Id22_11_, reportinge15_.Name as Name22_11_, recipients16_.PackageID as PackageID__17_, recipients16_.ID as ID17_, recipients16_.ID as ID5_12_, recipients16_.Version as Version5_12_, recipients16_.UserName as UserName5_12_, recipients16_1_.ClientID as ClientID7_12_, recipients16_1_.RoleID as RoleID7_12_, recipients16_2_.ContactID as ContactID8_12_, recipients16_3_.GroupID as GroupID9_12_, recipients16_4_.UserID as UserID10_12_, case when recipients16_1_.RecipientID is not null then 1 when recipients16_2_.RecipientID is not null then 2 when recipients16_3_.RecipientID is not null then 3 when recipients16_4_.RecipientID is not null then 4 when recipients16_.ID is not null then 0 end as clazz_12_, notes17_.PackageID as PackageID__18_, note18_.Id as NoteID18_, note18_.Id as Id11_13_, note18_.Version as Version11_13_, note18_.Summary as Summary11_13_, note18_.Note as Note11_13_, note18_.LoggedBy as LoggedBy11_13_, note18_.LoggedOn as LoggedOn11_13_, note18_.UserName as UserName11_13_, department19_.Id as Id20_14_, department19_.Name as Name20_14_, department19_.ShortName as ShortName20_14_, department19_.Code as Code20_14_ FROM dbo.RC_Packages this_ inner join dbo.RC_PackageReports reports3_ on this_.ID=reports3_.PackageID inner join dbo.RC_Reports report1_ on reports3_.ReportID=report1_.Id left outer join dbo.RC_Documents document5_ on report1_.DocumentID=document5_.Id left outer join dbo.RC_Types documentty6_ on document5_.TypeID=documentty6_.Id left outer join dbo.RC_SubTypes documentsu7_ on document5_.SubTypeID=documentsu7_.Id left outer join dbo.RC_Types documentty8_ on documentsu7_.TypeID=documentty8_.Id left outer join dbo.RC_DueDates duedate9_ on document5_.DueDateID=duedate9_.Id left outer join dbo.RC_DueDateTypes duedatetyp10_ on duedate9_.TypeID=duedatetyp10_.Id left outer join dbo.RC_Frequencies frequency11_ on document5_.FrequencyID=frequency11_.Id left outer join dbo.Departments department12_ on document5_.DepartmentID=department12_.Id left outer join dbo.RC_ReportingEngines reportinge13_ on document5_.ReportingEngineID=reportinge13_.Id left outer join dbo.RC_DocumentTemplates documentte14_ on document5_.TemplateID=documentte14_.Id left outer join dbo.RC_ReportingEngines reportinge15_ on documentte14_.ReportingEngineID=reportinge15_.Id left outer join dbo.RC_Recipients recipients16_ on this_.ID=recipients16_.PackageID left outer join dbo.RC_CATeamRecipients recipients16_1_ on recipients16_.ID=recipients16_1_.RecipientID left outer join dbo.RC_ContactRecipients recipients16_2_ on recipients16_.ID=recipients16_2_.RecipientID left outer join dbo.RC_GroupRecipients recipients16_3_ on recipients16_.ID=recipients16_3_.RecipientID left outer join dbo.RC_UserRecipients recipients16_4_ on recipients16_.ID=recipients16_4_.RecipientID left outer join dbo.RC_PackageNotes notes17_ on this_.ID=notes17_.PackageID left outer join dbo.RC_Notes note18_ on notes17_.NoteID=note18_.Id left outer join dbo.Departments department19_ on this_.DepartmentID=department19_.Id WHERE report1_.Name = ? and this_.IsActive = ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.