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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---