Timo,

You are the man! Thanks!  

              long userId = MySession.get().getUser().getId() 

Of course!

Cheers, Graeme.



Timo Rantalaiho wrote:
> 
> On Thu, 06 Nov 2008, Graeme Knight wrote:
>> perform a task of getting data from a database. Each model is dependent
>> on a
>> couple of pieces of information (1) an identifier about the current user
>> (2)
>> a primary key of a parent data object. I'm trying to work out the
>> mechanics
> 
> If "the current user" means what it sounds like, I would 
> probably have it stored in the Wicket Session and get it
> each time like this
> 
>   long userId = MySession.get().getUser().getId()
> 
> (Or you can make your user available in a custom ThreadLocal
> which is populated and depopulated in a custom RequestCycle.)
> 
>> Now my example above is not too bad resource wize - you may only be
>> talking
>> about a couple of Longs being serialized ten times (not a massive hit),
>> but
>> what about if the objects in my LoadableDetachableModel are fairly big?
> 
> The point of LoadableDetachableModel is to store in it only
> so little data that it doesn't matter, but load the big data
> again in load() on each request that needs it. The big data 
> is referenced directly only during the request, so it does
> not get serialised.
> 
>> Is there a way of destructing and reconstructing the model automatically
>> so
>> I don't need to worry about this serialization of the model private data?
> 
> The only automatic part is that if the model is "the default
> model" of a rendered component, its detach() will be called
> automatically at the end of the request processing. The 
> wrapping models that come with Wicket also detach their
> wrapped models in their own detach() (and any custom model
> should in general do the same).
> 
> Best wishes,
> Timo
> 
> -- 
> Timo Rantalaiho           
> Reaktor Innovations Oy    <URL: http://www.ri.fi/ >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/LoadableDetachableModels-with-replicated-data-fed-in-through-constructors.-tp20374062p20402019.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to