no. the example below doesnt hit any pitfalls because it doesnt
reference the session itself. as long as objects retrieved from
session do not contain references back to session he is ok.

however, declaring Session instance as final is not a good idea
because it makes it easy to reference it in anonymous classes.

-igor

On Mon, Nov 22, 2010 at 11:49 AM, Erik van Oosten <[email protected]> wrote:
> Yes, both are very wrong.
>
> Pitfalls are in earlier messages in this thread.
>
>
> On 22-11-10 16:36, [email protected] wrote:
>>
>> By "keep a reference to the session in their class" do you mean something
>> like this?
>>
>> Are there any pitfalls to doing this?
>>
>> final Session session = getSession();
>> add(new Label("userNameLabel", new Model(session.getUser
>> ().getUserName())));
>>
>> How about this?
>> final UserDTO dto = session.getUser();
>> CompoundPropertyModel cpm = new CompoundPropertyModel(dto);
>>
>
> --
> Sent from my SMTP compliant software
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
>
> ---------------------------------------------------------------------
> 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