no why would that be onBeginRequest? calling getUser would be when you need
in somewhere in your code



On 10/23/07, mfs <[EMAIL PROTECTED]> wrote:
>
>
> Makes sense...and calling the getUser method when you need it, and that
> would
> onBeginRequest ?
>
> Farhan.
>
>
>
> Johan Compagner wrote:
> >
> > No it has Nothing to do with how wicket caches or something
> > Its just how hibernate tracks its own session objects
> > And an object that you load in one request with a hibernate session
> object
> > if you try to reuse that object in another one then that object of the
> > last
> > time is not attached to the hibernate session of this request
> > So you get a StaleObjectException or something like that don't know
> > exactly
> >
> > And what does the wicket Session impl have to do with how YOU use
> database
> > object in it
> > Its just an object in the http session. We don't touch or do anything
> with
> > the objects you put into it.
> >
> > And in this example it has nothing to do with wickets lazy lookup.  (by
> > using detachable models like LoadableDetachableModel)
> > because if you want a user that you want pretty much all your request
> then
> > store the userid in the wicket session
> > and then in your custom request cycle do this:
> > MyRequestCycle
> > {
> >         User user = null;
> >         getUser()
> >         {
> >                if (user == null)
> >                 {
> >                       user = dao.loadById(getSession().getUserId());
> >                 }
> >                return user;
> >         }
> > }
> >
> >
> >
> > On 10/23/07, mfs <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> So basically what you are saying is that caching hibernate object in
> >> wicket's
> >> session can cause issues with hibernate when using the cached
> >> object...either in the same request or any subsequent request..right ?
> I
> >> wonder if that has anything to do with wickets session impl, its just
> >> would
> >> be true for any web-framework ?
> >>
> >> Also can you point me to an article on wicket's lazy lookup ? I still
> >> dont
> >> completely follow you..
> >>
> >>
> >>
> >> Johan Compagner wrote:
> >> >
> >> >>
> >> >>
> >> >> sorry but I dont completely get your point on hibernate objects not
> >> >> attached
> >> >> to the current session...can you please elaborate..I mean given the
> >> >> context
> >> >> in discussion if lets say i stored hibernate objects in the current
> >> >> session,
> >> >> would that cause any issues..is that what you mean OR ??
> >> >
> >> >
> >> > Sorry current Hibernate sessions. If you want to use your Wicket
> >> session
> >> > cached object
> >> > again in hibernate in that request then you get hibernate errors.
> >> (because
> >> > it is not attached to the current hibernate session)
> >> >
> >> >
> >> >> YOU mean using the lazy mechanism at the hibernate layer ?
> >> >
> >> >
> >> >
> >> > no the lazy lookup is in wicket.
> >> > your request cycle has an method getUser() and only when you call
> that
> >> you
> >> > load it in
> >> > Then it can be cached by hibernate in the second level cache of
> >> hibernate.
> >> >
> >> > johan
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Accessing-PageMap---tf4668934.html#a13354462
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Accessing-PageMap---tf4668934.html#a13370686
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to