From: NHibernate J. <mik...@us...> - 2006-12-05 07:33:33
|
[ http://jira.nhibernate.org/browse/NH-826?page=comments#action_14530 ] Ayende Rahien commented on NH-826: ---------------------------------- The issue is on SessionImpl, line 3396, and the problem is that a collection entry is loaded, even though there isn't any values (or owner) for it. Not sure where to find the issue. Here is the generated SQL; SELECT this_.Id as Id0_2_, activities2_.ActivitySetId as Activity1___4_, activityen3_.Id as ActivityId4_, activityen3_.Id as Id2_0_, activityen3_.ActivityType as Activity2_0_, questions4_.EvaluationActivityId as Evaluati2___5_, questions4_.Id as Id5_, questions4_.Id as Id3_1_ FROM co_activity_set this_ left outer join co_activity_set_membership activities2_ on this_.Id=activities2_.ActivitySetId left outer join co_activity activityen3_ on activities2_.ActivityId=activityen3_.Id left outer join co_question questions4_ on activityen3_.Id=questions4_.EvaluationActivityId WHERE this_.Id = 1 > Using Criteria to query for an item throws on Flush in some situations > ---------------------------------------------------------------------- > > Key: NH-826 > URL: http://jira.nhibernate.org/browse/NH-826 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta2 > Reporter: Aaron Jensen > Priority: Blocker > Attachments: NHibernateTest.zip > > The situation is best described by the attached sample project, but I will attempt to explain in words when this problem occurs. > EntityA has a many-to-many to EntityB > EntityB has a subclass EntityC > EntityC has a one-to-many to EntityD > If you create an EntityB and associate it to EntityA, then query for EntityA via Criteria (but not via HQL) then Session.Flush() will fail with: > NHibernate.HibernateException: You may not dereference an collection with cascade="all-delete-orphan" > at NHibernate.Impl.SessionImpl.UpdateUnreachableCollection(IPersistentCollection coll) in c:\net\nhibernate\nhibernat > e\src\NHibernate\Impl\SessionImpl.cs:line 3957 > at NHibernate.Impl.SessionImpl.FlushCollections() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs: > line 3802 > at NHibernate.Impl.SessionImpl.FlushEverything() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs:l > ine 3090 > The collection it is complaining about is a collection of EntityD objects which should never have been created in the first place. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |