i have these tables /entities
VacationRequestDate table which has a VacationRequestId field that links with VacationRequest table
VacationRequest has PersonId and RequestStatusId fields that links with Person and RequestStatus respectively.
i have this query so far:
IEnumerable<VacationRequestDate> dates = Session.Query<VacationRequestDate>().Fetch(r => r.VacationRequest).ThenFetch(p=>p.RequestStatus).ToList();
this works fine and joins with VacationRequest and then VacationRequest joins with RequestStatus but i can't figure out how to add an additional EAGER join to the VacationRequest table.
If i add a Fetch at the end, it refers to the VacationRequestDate table
If i add a ThenFetch at the end, it refers to the RequestStatus table
I can't find any api that will refer to the VacationRequest table as the reference point.
how would you add multiple joins to a joined table using nhibernate LINQ ?
While not 100% optimal because of an additional join, this works:
Session.Query<VacationRequestDate>()
.Fetch(r => r.VacationRequest).ThenFetch(p => p.RequestStatus)
.Fetch(r => r.VacationRequest).ThenFetch(p => p.Person)
The other querying methods (HQL, Criteria, not sure about QueryOver) don't have this limitation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With