Martijn,

I see your point about users clicking fast and causing an exception if
I keep a User in the session (transient or otherwise).  I too would be
curious to see some example code of how you handle the situation.

Thanks,
Tauren


On Mon, Feb 23, 2009 at 11:47 PM, Alexander Lohse <[email protected]> wrote:
> Hi Martijn,
>
> could you paste some short example code to point out how to load and access
> a UserModel in the requestcycle?
>
> Regards,
>
> Alex
>
> Am 23.02.2009 um 08:42 schrieb Martijn Dashorst:
> - Show quoted text -
>
>> 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 <[email protected]> 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
>>> <[email protected]> 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: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>>
>> --
>> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ______________________________________________________________
>
> "A designer knows he has achieved perfection not when there is nothing left
> to add,
> but when there is nothing left to take away."
> (Antoine de Saint Exupéry)
> .............................................................................................
>
> Alexander Lohse • Entwicklungsleitung & Projektmanagement
> Tel +49 38374 752 11 • Fax +49 38374 752 23
> http://www.humantouch.de
>
> Human Touch Medienproduktion GmbH
> Am See 1 • 17440 Klein Jasedow • Deutschland
>
> Geschäftsführung:
> Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
> Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684
> - Show quoted text -
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to