Hi Sebastien,

What exactly is the problem ?
LoadableDetachableModel loads its model object at first call to
#getObject() in the request cycle and null-ifies it at #onDetach(), i.e. at
the end of the request cycle.

If a LDM is reused by several components then it will be null-ified when
the first component detaches its model, so it will be detached when the
other components call their #detachModel() method but this should be fine
because at that time the model could not be used for anything because the
rendering has finished.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Nov 16, 2016 at 3:36 PM, Sebastien <[email protected]> wrote:

> Hi devs,
>
> It is sometimes hard to deal with LDM if we want the model to be shared by
> several components and/or wrapped in other model(s).
> In other words, how to answer the recurring question: "I want my model to
> be loaded once by request-cycle and detached once at the end of the
> request".
>
> Maybe to have an optional extra argument in model ctors which specify the
> retention policy: Component (default) or RequestCycle/Page ?
>
> Any opinion ?
>
> Thanks,
> Sebastien.
>

Reply via email to