Hi,
I am having a little difficulty in retrieving the nested collections. Here is my scenario.
Exam have Questions
Question have Choices
I need to get the Exam with questions and choices.
My query works till Questions but how can I get the choices for each Question.
exam = session.CreateQuery(@"select e from Exam e inner join e.Questions q
inner join q.Choices c where e.Id = :Id")
.SetString("Id", id.ToString())
.List<Exam>()[0];
The above query throws the lazy initialization exception.
Is there any other better way to handle this?
|