Jeremy,
     Thanks a lot. This was the problem. But then I have a question about
design I made:

I am using wizard a lot and I found that having a "bean" that collects al
the entitties through the steps makes my code cleaner. For instance, I can
hide some model manipulation into it. But I rose this situation, where I had
to implement IDetachable in my bean.

What do you think about?



On Wed, Nov 11, 2009 at 5:16 PM, Jeremy Thomerson <[email protected]
> wrote:

> Are you holding the model as an instance variable somewhere?  If so, you'll
> need to detach it manually.  The component only auto-detaches the default
> model.
>
> i.e. this will get auto-detached:
>
> public class SomeComponent extends Component {
>  public SomeComponent(String id, IModel model) {
>    super(id, model); // this will go into default model and will be
> auto-detached
>  }
> }
>
> i.e. this will NOT get auto-detached:
>
> public class SomeComponent extends Component {
>  private IModel myModel;
>  public SomeComponent(String id, IModel model) {
>    super(id);
>    myModel = model; // this will not be auto-detached
>  }
>
>  // you need this:
>  public void onDetach() {
>    myModel.detach();
>  }
> }
>
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Wed, Nov 11, 2009 at 10:52 AM, Fernando Wermus <
> [email protected]
> > wrote:
>
> > Hi all,
> >     I have a wizard with five wizardSteps.
> >
> > Also I have an LDM called EntityModel,
> >
> > EntityModel extends LDM{
> >
> > EntityModel(Key key)
> >    this.key=key;
> > }
> >
> > load(){   // I  look up for the entity with the key}
> >
> > }
> >
> > But I have a case where it doesnt behave as expected.
> > There is a case where the fifth step consults to EntityModel to get the
> > entity and it doesnt look up the db because it does have the entity in
> its
> > transient attribute. Thus, I got a LazyLoadingException.
> >
> > Isnt it supposed that  LDMs get rid off transient objects for each
> request?
> >
> > Why is this case behaving in this way?
> >
> > Am I supposed to overwrite onAttach to verify that the entity attached is
> > not still connected to the session? I thought LDM will work it out.
> >
> > thanks in advance
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>



-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Reply via email to