Hi all,
I have a doubt about how can I fetch a collection in a HQL command. If someone could help me, i'm thank a lot =D
I hava this Domain model:
Code:
public class Category {
public int Id { get; set; }
public string Name { get; set; }
public IList<SubCategory> SubCategories { get; set; }
}
public class SubCategory {
public int Id { get; set; }
public string Name { get; set; }
public Category Category { get; set; }
}
I would Like to know, How can I do a command that return a IList of Category and for each object in this list, fetch the IList<SubCategory> with a sub-query command ? I have been test this command:
string hql = "from Category c inner join fetch c.SubCategories order by a.Name";
This command works, but this create a Category object for each subcategory... and repeat categories in my list (menu of my website)
Well, if someone can help... Thanks a lot
PS: Sorry for my English
cheers