It might work if you dont have any ajax on your page. otherwise each ajax call 
happens in a new request and causes your domain object to be retrieved from 
the database.
this way you lose every change made to your object. writing all changes to 
database before detaching can be an option, but then you might persist 
something to your datastore that is in the midst of being edited.
i would be glad to offer a solution to the problems i just brought up, but i 
am struggling with this problem ever since i started using wicket.

On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
wrote:
> Yup the way that I do it too almost down to every line:)
>
> Michael Sparer wrote:
> > When using the OSIV-filter the lazyload exception may only happen if the
> > same entity is used among different requests ... sothat it gets detached
> > from hibernate. have a look at
> > http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
> >blemode.html ... that's the way we're doing it
> >
> > regards,
> > Michael
> >
> > Korbinian Bachl - privat wrote:
> >>  >I think it could be something about
> >>  > missing usage of loadabledetachable model..?
> >>
> >> not for me, as the original entity is pulled using an
> >> loadabledetachableModel via a SortedDataProvider :/
> >>
> >> if you look around, the all called solution for this is the
> >> "OpenSessionInViewFilter" and the usage of
> >> <bean id="transactionManager"
> >> class="org.springframework.orm.jpa.JpaTransactionManager">
> >> for that (latter one is used by me, too)
> >>
> >> However, the OpenSessionInViewFilter will not work with wicket, even if
> >> mapped to "/*" in the web.xml
> >>
> >> Best,
> >>
> >> Korbinian
> >>
> >> Nino Saturnino Martinez Vazquez Wael schrieb:
> >>> Hi Korbinian
> >>>
> >>> Im facing the same problems... I also use extended.. So gonna be great
> >>> to see the outcome of this thread.. I think it could be something about
> >>> missing usage of loadabledetachable model..?
> >>>
> >>> Korbinian Bachl - privat wrote:
> >>>> Hi,
> >>>>
> >>>> I'm currently struggling with the famous "lazy load exception" under
> >>>> spring + jpa with wicket.
> >>>>
> >>>> The problem is, in my case, that i pull an entity from the database
> >>>> using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
> >>>> wicket class i need to walk the entity tree a bit, based on the needs
> >>>> of the user (preloading wont work, as i dont know the direction the
> >>>> user wants to walk and the whole entity tree is too complex to grab it
> >>>> all at once).
> >>>>
> >>>> If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy
> >>>> load exception (transaction already closed). So I tried to use the
> >>>> OpenSessionInViewFilter to solve this, but it just won't work - no
> >>>> reason why, as the error stays exactly the same.
> >>>>
> >>>> Currently I ended up using this:
> >>>> @PersistenceContext(type = PersistenceContextType.EXTENDED)
> >>>> private EntityManager em;
> >>>>
> >>>> However, I'm not sure if this is the way it is supposed to be?
> >>>> ( I read so far that this disables a big part of springs-transaction
> >>>> handling support but didnt see any impacts so far)
> >>>>
> >>>> Has anyone a different aproach/ solution for this using wicket +
> >>>> spring with JPA?
> >>>>
> >>>> Best,
> >>>>
> >>>> Korbinan
> >>>>
> >>>> PS: im on wicket 1.4-m3
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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]
> >
> > -----
> > Michael Sparer
> > http://talk-on-tech.blogspot.com

Reply via email to