Hi Mathilde,

The story must be more complicated than your addition of a
HeaderContributor. Somehow you're serializing a Questionnaire into your
Wicket session, and when it's used in a subsequent request, the Hibernate
session associated with its lazy collection of questions has been closed.
One way to troubleshoot this is to change Questionnaire so it is not
Serializable; then you will see the problem closer to its source. The best
solution is to create an IModel for Questionnaire so that the entity itself
is not serialized.

Hope that helps,
Dan

On Thu, Aug 4, 2011 at 8:05 AM, Mathilde Pellerin <
[email protected]> wrote:

> Hi all,
>
> I want to override some style of modal window, so I created a css file and
> I
> added it on the modal window constructor :
>
> public class ModalWindowE4N extends ModalWindow {
>
>    public ModalWindowE4N(String id, String titre) {
>        super(id);
>        add(CSSPackageResource.getHeaderContribution("modalE4N.css"));
>        this.setTitle(titre);
>        this.setUseInitialHeight(false);
>        this.setHeightUnit("px");
>        this.setWidthUnit("px");
>        this.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
>        this.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
>    }
>
>    private static final long serialVersionUID = 5439940276271822354L;
>
> }
>
> But then, when I click on the AjaxLink which must show the modal window, I
> have this error :
>
> ERROR - azyInitializationException - failed to lazily initialize a
> collection of role:
> fr.statlife.protoE4N.data.entites.Questionnaire.listeQuestions, *no session
> or session was closed*
> org.hibernate.LazyInitializationException: failed to lazily initialize a
> collection of role:
> fr.statlife.protoE4N.data.entites.Questionnaire.listeQuestions, no session
> or session was closed
>    at
>
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
>    at
>
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)
>    at
>
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:368)
>    at
>
> org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:111)
>    at
> org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:272)
>    at
>
> fr.statlife.protoE4N.pages.membre.QuestionnaireContentPanel.initialiserQuestionnaire(QuestionnaireContentPanel.java:181)
>    at
>
> fr.statlife.protoE4N.pages.membre.QuestionnairesPage$BoutonRemplirQuestionnaire$1.onClick(QuestionnairesPage.java:116)
>    [...]
>
> obviously, my session is closed by adding the CSSPackageResource (because
> when I comment this line, everything works well), and I don't understand
> why.
> What am I doing wrong?
>
> Thanks
> M.
>
> --
> *Mathilde Pellerin*
> Ingénieur en développement de logiciel
>
> STATLIFE
> tel : 01.42.11.64.88
> mail : [email protected]
>

Reply via email to