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