When the hibernate session is closed you will get a lazy initialization error 
if they proxy tries to load any lazy fields.


On Nov 20, 2009, at 9:34 AM, Martin Makundi wrote:

>> The object is a hibernate pojo, which has to be detached because it can't be
>> used after the hibernate session dies. The hibernate session dies on every 
>> request.
> 
> Why not? I reuse the hibernate pojos throughout the whole user web session.
> 
> **
> Martin
> 
> 
>> 
>> D/
>> 
>> On Nov 20, 2009, at 9:19 AM, Martin Makundi wrote:
>> 
>>> Why should it be detached every request if it is lightweight?
>>> 
>>> It seems you have a problem elsewhere? Maybe you have problems with
>>> object equalities etc?
>>> 
>>> YOu can override MySession.detach to detach it.
>>> 
>>> **
>>> Martin
>>> 
>>> 2009/11/20 Douglas Ferguson <doug...@douglasferguson.us>:
>>>> Yeah, but how to I guarantee that it will be detached and reloaded on 
>>>> every request.
>>>> 
>>>> Also, the application is already using the session as the factory for this 
>>>> loadable detachable.
>>>> Just out of curiosity, I cached it rather than always constructing a new 
>>>> one, and I started getting all sorts of errors.
>>>> 
>>>> So then I started to think that perhaps I could try make sure that a new 
>>>> one is generated per request.
>>>> I tried using a thread local to hold the LDM on the session but that 
>>>> caused the same errors.
>>>> 
>>>> D/
>>>> 
>>>> On Nov 19, 2009, at 5:32 PM, Igor Vaynberg wrote:
>>>> 
>>>>> the whole point of "LoadableDetachable" is that you load it once and
>>>>> reuse it until detached, at least this is how LDM works.
>>>>> 
>>>>> -igor
>>>>> 
>>>>> On Thu, Nov 19, 2009 at 2:50 PM, Douglas Ferguson
>>>>> <doug...@douglasferguson.us> wrote:
>>>>>> I am maintaining an app that is written in wicket.
>>>>>> 
>>>>>> When a user logs in the userId is stored on the session.
>>>>>> There is a method on the session object that returns a 
>>>>>> UserAccountLoadableDetachable.
>>>>>> This loadable detachable is created every time the method is called.
>>>>>> 
>>>>>> My thought was that I could share it across the request.
>>>>>> 
>>>>>> D/
>>>>>> 
>>>>>> 
>>>>>> On Nov 19, 2009, at 3:53 PM, Igor Vaynberg wrote:
>>>>>> 
>>>>>>> whats the usecase for a request-scoped variable?
>>>>>>> 
>>>>>>> you can have a transient field on the page that you null in 
>>>>>>> ondetach()...
>>>>>>> 
>>>>>>> otherwise you can access httpservletrequest and use attributes.
>>>>>>> 
>>>>>>> -igor
>>>>>>> 
>>>>>>> On Thu, Nov 19, 2009 at 1:51 PM, Douglas Ferguson
>>>>>>> <doug...@douglasferguson.us> wrote:
>>>>>>>> is there a best practice for request scoped variables in wicket?
>>>>>>>> 
>>>>>>>> D/
>>>>>>>> 
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>> 
>>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to