Any ideas why I might be getting “No persister for: System.Collections.Generic.List” exception when executing the query below?
var subs = new List<Subsection>();
var subsections = Session.QueryOver<Subsection>()
.WhereRestrictionOn(s => s.Id)
.IsInG(subsectionIds)
.List<Subsection>();
Location foreignExpertLocation = null;
var result = Session.QueryOver<InternationalLawyerExpertise>()
.JoinAlias(i => i.ForeignExpertLocation, () => foreignExpertLocation)
.JoinAlias(() => foreignExpertLocation.Subsections, () => subs)
.AndRestrictionOn(() => subs).IsInG(subsections)
.Where(i => i.ForeignExpertLocation == location && i.Status.Id == _confirmed)
.Fetch(lawyer => lawyer.PersonOrganisation.Person).Eager
.Fetch(lawyer => lawyer.PersonOrganisation.Organisation).Eager
.List<InternationalLawyerExpertise>();
return result;
The issue most likely would be in the way how you are creating the
subsections“subquery”. Try to check this answer: https://stackoverflow.com/a/14080092/1679310NOTE: There is missing your mapping and definiton of classes, so take this as a “how to” based on your snippet. You should create the detached query:
and then use it:
So you can directly in one select filter with inner select (NHibernate will then inject subselect into your main query).
… or provide more details about your mapping..