model view controller - Nhibernate - Loading entity with HasMany collection in web app -


First of all, trying to visit someone else at forum.hibernate.org. I was trying a little while. Below it can not believe.

I'm new to NHibernate, get easy.

I have an MVC app and I have a method called the recipe and has HasMany archive comments, content and images.

In the action of an MVC controller I am loading the first 20 recipes to load on my home page.

I am using the following HQL to do this. I want to prefetch images so that I can display the first one. But my first recipe has 3 images, so the query results in 3 rows for a recipe.

  string sql = "to cook" + "left add RI images" + "Inner start join the RUUSER" + "where rcompleted! = 0 "; IList & LT; Recipe & gt; Recipes = (ILIIT & lt; Cooking & gt;) session. Composition (SKL) SatMax Results (20) List & amp; LT; Method & gt; ();  

What method is I using to load 20 recipes for the first time? I do not want to layarize the images, because it is loaded in the list controller operation so that the images can not be loaded when I tell them in my user control.

Malcolm

Try it out:

  String sql = "cookie" + "left-hand RI images" + "inner inner incoming R. User" + "Where Ramped! = 0"; Var derived = session. Creatio (SQL) .setceltol transformer (criteria utility distinchutoot intystem) .customizer results (20). List and lieutenant; Recycle & gt; ();  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -