Thanks Jeremy.

I have those conversations often - especially over silly things.

I need to go back and look at the ins and outs of serialization. I guess if
I have several private references to the same object in multiple
LoadableDetachableModels I guess the actual object itself only gets
serialized once (i.e. there are never multiple copies of it being stored
over time on disk)... Not to concerned. Just a mad moment :-) One of many
:-) More to come :-)

Cheers, Graeme. 


Jeremy Thomerson-5 wrote:
> 
> I hate to interrupt your conversation with yourself (I've had those days
> myself) :)
> 
> Basically, I would say you needn't worry so much about serializing a
> couple
> of Longs - that's the point of the LoadableDetachableModel - serializing a
> couple of Longs rather than dozens (or hundreds) of User / Customer /
> Article / WhateverYourDomainObject instances.
> 
> You can't make the private variables in your example transient - then they
> wouldn't get serialized, which means they wouldn't be available later when
> the page is deserialized and the model is supposed to reinflate itself.
> 
> Hope this helps put your mind at ease.  Get some rest.  :)
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> On Thu, Nov 6, 2008 at 9:58 PM, Graeme Knight <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Oh - tired! Long hard days working with spaghetti in my day job and
>> lasagna
>> in my night time...
>>
>> I realized this may be a dumb question. Doesn't an object only get
>> serialized once no matter how many references would be made to it in a
>> LoadableDetatchableModel? I.e. you wouldn't get 10 userIds serialized,
>> just
>> 1... (which would be just peachy and fine).
>>
>> Thanks, Graeme. :-)
>>
>>
>> Graeme Knight wrote:
>> >
>> > Hi.
>> >
>> > I have a number of LoadableDetachableModels that are each designed to
>> > 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 and life cycle of the model object...
>> >
>> > So, my class might look like:
>> >
>> > public class GetAccountsModel extends LoadableDetachableModel
>> > {
>> >     private Long userId;
>> >     private Long parentPrimaryKey;
>> >
>> >    public GetAccountsModel( Long userId, Long parentPrimaryKey )
>> >    {
>> >       this.userId = userId;
>> >       this.parentPrimaryKey = parentPrimaryKey;
>> >    }
>> >
>> >    ...... override load here .....
>> > }
>> >
>> > Let's say I have ten similar LoadableDetachableModels all of which take
>> > the same parameters in the constructor, but all of which return
>> different
>> > data from the database.
>> >
>> > When I create a LoadableDetachableModel as above and call the super
>> > constructor of (for example) a ListView, the model is fed into the
>> > ListView and load is called (with the transient object being detached).
>> >
>> > The userId and primaryKey get serialized. So if I have ten similar
>> models
>> > which get different data, I am serializing the same (or very similar)
>> data
>> > 10 times, specifically the userid.
>> >
>> > If figured I could probably make the userID and primaryKey transient
>> then
>> > they would not serialize. I'm not sure if this would have a negative
>> > affect if I go to another page (i.e. current page is out of memory) and
>> > come back - what happens?
>> >
>> > 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?
>> >
>> > 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?
>> >
>> > Or... am I panicking about nothing? I may be completely
>> misunderstanding
>> > the whole concept here.
>> >
>> > Any explanation welcome - I appreciate your time reading this post.
>> >
>> > Thanks, Graeme.
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/LoadableDetachableModels-with-replicated-data-fed-in-through-constructors.-tp20374062p20374412.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]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/LoadableDetachableModels-with-replicated-data-fed-in-through-constructors.-tp20374062p20380030.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