Thanks Michael.
But I don't use the OpenSessionInviewFilter and I don't want to use it.
It creates more problems than it solves in my edit pages.
The LoadableDetachableModel will load the whole list of choices, not
just the one that was selected by the user.
I will encounter the same error except if the
LoadableDetachableModel.load method pre-fetch the associations...
Cedric
On Tue, Sep 16, 2008 at 3:01 AM, Michael Sparer <[EMAIL PROTECTED]> wrote:
>
> Use LoadableDetachableModels (and be sure that the OpensessionInviewFilter
> goes before the wicketfilter) and your hibernate entity will always be in
> the right session
>
> regards,
> Michael
>
> thiebal wrote:
>>
>> My DropDownChoice contains a list of hibernate entities that are not
>> fully loaded.
>> But when I select a value in the dropdown I receive a
>> LazyLoadingException because Wicket tries to add an entry in a
>> collection that was not previously loaded.
>>
>> I tried to use a Converter but it is not called because
>> PropertyResolverConverter set directly the value (because their
>> classes are compatible) :
>> if (clz.isAssignableFrom(object.getClass())) {
>> return object;
>> }
>>
>> It works if I preload each entry in the list of choices of the
>> DropDownChoice but it is very expensive. To display the dropdown, I
>> just need to retrieve the name of my hibernate entity, not the
>> collection inside this bean.
>> I would like to load the collection only when the user select an
>> option in the select.
>>
>> Code :
>> class Foo {
>> Bar bar;
>>
>> void setBar(Bar bar) {
>> this.bar = bar;
>> bar.getFoos().add(this); // this will throw a
>> LazyLoadingException if I don't fetch the collections before I render
>> the DropDownChoice
>> }
>> }
>>
>> class Bar {
>> Collection<Foo> foos;
>> }
>>
>> Is there a nice way to do that ?
>>
>> Thanks in advance :-)
>>
>> Cedric
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
> -----
> Michael Sparer
> http://talk-on-tech.blogspot.com
> --
> View this message in context:
> http://www.nabble.com/DropDownChoice-and-lazy-loaded-choices-tp19501118p19506463.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]