while i couldnt identify which object is throwing the
lazyInitialization, the problem is probably that the entity is not
associated with the hibernate session. On the request that opens the
ModalWindow you must either reload or reatach the entity

On Thu, Oct 1, 2009 at 7:55 PM, Albert Romanius <a.roman...@gmail.com> wrote:
> Hi,
>
> I am working with wicket and jpa/hibernate/spring. I am trying to
> create a ModalWindow, but I get a LazyLoadingException. I tryed the
> OSIVpattern, but it did not work.
> Using the modal inside a form does not make any difference also.
>
> Has anyone else this problem?
>
>
> The page which the modalWindow is triggered has:
> ===============
>  AjaxLink link = new AjaxLink("openModal") {
>                   �...@override
>                    public void onClick(AjaxRequestTarget target) {
>                        modalWindow.setPageCreator(new
> ModalWindow.PageCreator() {
>                            public Page createPage() {
>                                return new MyModalPage(modalWindow,
> messageListModel.getObject().get(0));
>                            }
>                        });
>                        modalWindow.show(target);
>                    }
>   };
> ==============
>
> #Modal Panel
> ==============
> public class MyModalPage extends WebPage {
>
>   �...@springbean
>    GeneralRepository generalRepository;
>
>    Set<SubMessage> selectedSubs = new HashSet<SubMessage>();
>
> public MyModalPage(final ModalWindow window, Message message) {
>
>        Message showMessage = (Message)
> generalRepository.<Message>getById(message.getId(), Message.class);
>
>        //showMessage.getLazyList().size();
>
>        Form f = new Form("form");
>        add(f);
>
>        CheckBoxMultipleChoice subMessagesCB = new CheckBoxMultipleChoice(
>                "subMessages", new PropertyModel(this,
> "selectedSubs"), showMessage.getLazyList());
>        f.add(subMessagesCB);
>
>        AjaxButton saveButton = new AjaxButton("save") {
>
>           �...@override
>            protected void onSubmit(AjaxRequestTarget target, Form<?> arg1) {
>                window.close(target);
>            }
>        };
>
>        f.add(saveButton);
>
>        add(new AjaxLink("closeCancel")
>        {
>           �...@override
>            public void onClick(AjaxRequestTarget target)
>            {
>                window.close(target);
>            }
>        });
>
>
>    }
> ==========
>
>
> --
> Albert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
http://mapsdev.blogspot.com/
Marcelo Takeshi Fukushima

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to