Hello All, I have been trying to design functionality of a webapp using wizard. I need to pass a object (Questionnaire) to the wizard page, the object contains a set of questions. on passing the object, when I try to pick the set of questions using q.getqn() where q is the object, a null set is returned and I get a error saying: LazyInitializationException:19 - failed to lazily initialize a collection of role: questionnaire.model.Questionnaire.qn, no session or session was closed
I have searched and found lots of articles about this error but I guess my programming is still imature cause I seem not to get this to work yet. Below is my code is there a way of passing the previous session to this class. public final class AnswerWizard extends Wizard { public AnswerWizard(String id, Questionnaire q) { super(id); // create a model with a couple of custom panels // still not that spectacular, but at least it // will give you a hint of how nice it is to // be able to work with custom panels WizardModel model = new WizardModel(); Set questions = q.getQn(); Iterator iter = questions.iterator(); System.out.println("Testing55: " ); for (;iter.hasNext();) { Question qn = (Question) iter.next(); if (qn instanceof QuestionShortAns) { model.add(new StepQSA((QuestionShortAns) qn)); } else if (qn instanceof QuestionSingleSelect) { model.add(new StepQSS((QuestionSingleSelect) qn)); } else if (qn instanceof QuestionMatch) { model.add(new StepQm((QuestionMatch) qn)); } } // initialize the wizard init(model); } private static final class StepQSS extends WizardStep { /** * Construct. */ public StepQSS(QuestionSingleSelect qn) { super("One", "The first step"); } } private static final class StepQSA extends WizardStep { /** * Construct. */ public StepQSA(QuestionShortAns qn) { super("Two", "The second step"); } } private static final class StepQm extends WizardStep { /** * Construct. */ public StepQm(QuestionMatch qn) { super("Three", "The third step"); } } public void onCancel() { //setResponsePage(Index.class); } /** * @see org.apache.wicket.extensions.wizard.Wizard#onFinish() */ public void onFinish() { // setResponsePage(Index.class); } } Any Help will be highly appreciated