How to get an object with its entities in nhibernate?
I want to get an object with its additional properties. How can I do this with nhibernate without specifying in the mapping. I want to control the selection, as we can do in linq-to-sql using the LoadWith () method. Not an automated solution.
public class Survey
{
public virtual long Id;
public virtual String Title;
public virtual IList<SurveyPage> Pages;
}
I want to get a poll with its Pages properties loaded, in one single request without using a mapping file. How can I do this in nhibernate?
+1
a source to share
2 answers
Yes, FetchMode is one way to do it. Some great things:
-
You can only set fetchmode to one collection (at a time) of the mapping file.
-
When you do select mode on linked assemblies, it will return row concatenation. (Will not split unique parent strings).
Another way to do the same is to use an HQl query with Join.
0
a source to share