I think it's:
.CreateCriteria<Core.Domain.Application>()
.SetFetchMode("ApplicationWorkflows" ,FetchMode.Eager)
.SetFetchMode("ApplicationWorkflows.ApplicationStatus",
FetchMode.Eager)
...
--------------------------------------------------
From: "Mike" <[email protected]>
Sent: Monday, August 30, 2010 4:46 PM
To: "nhusers" <[email protected]>
Subject: [nhusers] Re: Setting FetchMode on a grandchild object
Hello,
How would I perform this using simple criteria API with no lamdba
extensions? Thanks!
On Jul 6, 4:12 pm, "Richard Brown \(gmail\)" <[email protected]>
wrote:
IIRC you can write:
.CreateCriteria<Core.Domain.Application>()
.SetFetchMode<Core.Domain.Application>(app =>
app.ApplicationWorkflows,FetchMode.Eager)
.SetFetchMode<Core.Domain.Application>(app =>
app.ApplicationWorkflows[0].ApplicationStatus,FetchMode.Eager)
.Add(SqlExpression.In<Core.Domain.Application>(app =>...
Also remember to consider
performance:http://nhforge.org/blogs/nhibernate/archive/2008/09/06/eager-loading-...
--------------------------------------------------
From: "Mike" <[email protected]>
Sent: Tuesday, July 06, 2010 7:46 PM
To: "nhusers" <[email protected]>
Subject: [nhusers]SettingFetchModeon agrandchildobject
> I have the following Criteria query (using Lambda extensions):
> var workflowResult = repository.GetSession()
> .CreateCriteria<Core.Domain.Application>()
> .SetFetchMode<Core.Domain.Application>(app =>
> app.ApplicationWorkflows,FetchMode.Join)
> .Add(SqlExpression.In<Core.Domain.Application>(app =>
> app.ID, uniqueIds))
> .SetResultTransformer(new
> DistinctRootEntityResultTransformer())
> .Future<Core.Domain.Application>();
> This is working correctly. Each Application eagerly loads the
> ApplicationWorkflows collection. However, I'd like to go one deeper
> and load the ApplicationStatusobjectof each ApplicationWorkflow. I
> can do this with the following HQL but would like to translate to
> Criteria:
> var workflowQuery = "SELECT DISTINCT app" +
> " FROM Application app" +
> " JOIN FETCH app.ApplicationWorkflows
> awf" +
> " JOIN FETCH awf.ApplicationStatus" +
> " WHERE app.ID IN (:appList2)";
> Thanks!
> --
> 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.
--
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.