Having access to the complete user object, comes in handy if you use
compound models.. Like the CompundPropertyModel...

But I see your point.. But it's also sort of what the LDM does, store some
kind of identifier and then looks up the user if its not already loaded..

2009/2/23 Brill Pappin <br...@pappin.ca>

> Jumping in here part way through the thread, so apologies if you've covered
> this already.
>
> What we do is simply store a key that represents the user (and maybe a
> small amount of data that is accessed about the user on every page).
> In general we find that our persistence is much more reliable if we don't
> try to optimize it before we know that we need to.
> Most operation only really require the user key to get or update data as
> the user authentication data doesn't change all that much (it's all the data
> attached to the user that does).
>
> In general I can't image you need to store a whole user object transient or
> not.
>
> Hope that helps,
>
> - Brill
>
>
>
>
> On 23-Feb-09, at 2:42 AM, Martijn Dashorst wrote:
>
>  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
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to