Fixed the test of your patch (there was a bug), applied the patch, added an improv. NH-2670, and added a new test with the Naturalness mapping-by-code with the example about how you can map generic-entities (in this case was Family<T> where T: Animal).
Note: this mail was only to let you know about the new mapping-by-code options (in the many-to-one of the generic class NH can't directly recognize the association... will be fixed in some moment) On Sat, Apr 23, 2011 at 12:50 PM, Rory Plaire <[email protected]> wrote: > As for the affected versions, I just tried to copy what was in Hibernate's > issue. I ran the other tests without issue, though now I see you updated the > issue with a broken test. Perhaps I missed it. I'll check the corresponding > test on the Hibernate side. > > -r > > On Sat, Apr 23, 2011 at 4:23 AM, Fabio Maulo <[email protected]> wrote: > >> Rory, >> have you tried if the patch break others tests ? >> >> >> On Fri, Apr 22, 2011 at 10:36 PM, Rory Plaire <[email protected]>wrote: >> >>> Apparenlty this is a limitation in the recursive load cycle of the >>> stateless session whereby the temporary persistence context was being >>> cleared on each recursive load, meaning previously loaded entities were not >>> in the entity map. >>> >>> This issue was fixed in Hibernate, and I've ported the fix over to >>> NHibernate here: http://216.121.112.228/browse/NH-2669 >>> >>> -r >>> >>> On Thu, Apr 21, 2011 at 5:35 PM, Rory Plaire <[email protected]>wrote: >>> >>>> Hi all - >>>> >>>> I'm cross-posting this from SO, since although this is the "official" >>>> channel, there is better findability over there. >>>> >>>> >>>> http://stackoverflow.com/questions/5751197/eager-fetching-of-a-great-grandchild-collection-using-a-stateless-session-via-nhi >>>> >>>> I'm using an NHibernate Stateless Session to load bulk data into the >>>> database. As data is loaded, later entities need to lookup previous >>>> entities >>>> in order to add them to child collections. This operation involves needing >>>> data on a grandchild object, which in turn needs a great-grandchild >>>> collection to be available. >>>> >>>> The criteria looks like this: >>>> >>>> var result = InternalRepository.CreateCritera<Root>() >>>> >>>> >>>> >>>> >>>> .SetResultTransformer(Transformers.DistinctRootEntity) >>>> >>>> .Add(Restrictions.IdEq(id)) >>>> >>>> .SetFetchMode("Child", FetchMode.Eager) >>>> >>>> .CreateAlias("Child", "a", JoinType.LeftOuterJoin) >>>> >>>> >>>> >>>> >>>> .SetFetchMode("a.Grandchild", FetchMode.Eager) >>>> >>>> .CreateAlias("Grandchild", "b", JoinType.LeftOuterJoin) >>>> >>>> >>>> >>>> >>>> .SetFetchMode("b.GreatGrandchildCollection", >>>> FetchMode.Eager) >>>> >>>> >>>> >>>> >>>> .UniqueResult<Root>(); >>>> >>>> When I execute this, TwoPhaseLoad throws an exception during >>>> InitializeEntity since the session's persistence context entity entries >>>> are empty: >>>> >>>> at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean >>>> readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, >>>> PostLoadEvent postLoadEvent) in TwoPhaseLoad.cs: line 64 >>>> >>>> >>>> >>>> >>>> at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList >>>> hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean >>>> readOnly) in Loader.cs: line 603 >>>> >>>> >>>> >>>> >>>> at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, >>>> QueryParameters queryParameters, Boolean returnProxies) in Loader.cs: line >>>> 472 >>>> >>>> >>>> >>>> >>>> at >>>> NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor >>>> session, QueryParameters queryParameters, Boolean returnProxies) in >>>> Loader.cs: line 243 >>>> >>>> >>>> >>>> >>>> at NHibernate.Loader.Loader.DoList(ISessionImplementor session, >>>> QueryParameters queryParameters) in Loader.cs: line 1694 >>>> >>>> >>>> >>>> ... >>>> >>>> The entity the loader is looking up is the Child entity. Why is the >>>> persistence context entries map empty here? The object is apparently being >>>> fetched (the correct SQL is generated and returns correct results), and the >>>> "Child" entity is created correctly. Why is the entity construction state >>>> incorrect? Does it have to do with how the stateless session uses the >>>> temporary persistence context during eager loads? >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >> >> >> >> -- >> Fabio Maulo >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
