Storing the user in a field of Session is wrong. Didn't you read the
concurrency caveats I posted earlier?

When users click fast enough, you'll get Hibernate exceptions pretty
soon. Entity instances can't be shared between multiple threads.
Putting them in the Session exposes them to that threat. Putting
transient before the field doesn't mitigate that, neither does
synchronized.

Martijn

On Fri, Feb 20, 2009 at 11:25 PM, Tauren Mills <tau...@groovee.com> wrote:
> Nino and Martijn,
>
> Thanks for the help.  Last night I was looking through the elephas
> code and found a solution that I think will work for me.  It doesn't
> store an LDM in the session, but stores an identifier and a
> *transient* instance of User.  This seems like an effective solution
> to me. I tried it out and haven't had problems yet.  Here's the
> elephas session so you can see for yourself:
> http://code.google.com/p/elephas/source/browse/trunk/src/main/java/org/elephas/webapp/application/ElephasSession.java?r=87
>
> Then on my page, I just do something like this:
> setDefaultModel(new DetachableUserModel(getSession().getUser(),userDao));
>
> Please let me know your thoughts on this.
>
> Thanks,
> Tauren
>
>
> On Fri, Feb 20, 2009 at 2:05 AM, nino martinez wael
> <nino.martinez.w...@gmail.com> wrote:
>> Hi Tauren
>>
>> I've done something similar.. Have no trouble with..
>>
>> Disclaimer, below code are really ugly and I need to clean it up...
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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

Reply via email to