Hi Fabio - thank you for the reply.

So what you are saying is that, I cannot do what I am trying to do,
correct?

Do you know of any workarounds?

Thomas


On 4 Sep., 16:20, Fabio Maulo <[email protected]> wrote:
> Probably the problem is that Criteria does not throw the exception we are
> throwing in HQL.You can't use join fetch so deeper using a <bag>
>
> 2009/9/4 Thomas Koch <[email protected]>
>
>
>
>
>
>
>
> > Hi - Iam trying to load a nested object graph in one go to the
> > database.
>
> > I have the following class structure:
>
> > Report -* ReportArticle  -* VolumeAgreement -* DeliveryReport
>
> > A report has a bag of report-articles, each of which in turn have a
> > bag of volume-agreements which in turn has a bag of delivery-report.
>
> > Now to compute the status of the report i need to load all of the
> > related objects down to the delivery-report.
>
> > I have tried
>
> >            var transformer = new DistinctRootEntityResultTransformer
> > ();
>
> >            var reportCriteria = NHibernateSession.CreateCriteria
> > (typeof(Report));
> >            reportCriteria.Add(Restrictions.IdEq(reportId));
> >            reportCriteria.SetResultTransformer(transformer);
> >            reportCriteria.SetFetchMode("ReportArticles",
> > FetchMode.Join);
> >            reportCriteria.SetFetchMode
> > ("ReportArticles.VolumeAgreements", FetchMode.Join);
> >            reportCriteria.SetFetchMode
> > ("ReportArticles.VolumeAgreements.DeliveryReports", FetchMode.Join);
>
> >            var reports = reportCriteria.List<Report>();
> >            report = reports.FirstOrDefault();
>
> > However, the collection of VolumeAgreements is still multiplied many
> > times over in the ReportArticles. It is as if the ResultTransformer is
> > not applied to this level.
>
> > Any suggestions would be appreciated.
>
> > Kind regards
> > Thomas
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to