Models are is already completely lazy.
Only when the model object (so the contents) is asked then the attached is called.

I don't know exactly youre setup but do you have everthing in a form?
So with a submit all objects are filled in (so all objects must be loaded)
then you could load youre objects at once in youre main model.

If you are really sure that the main model with the complete list is stable then all the list items could store a index to the model
So then you only have one attachable model. That does one query to get the complete list.
But you have to make sure then that the textfield's model data that is used for rendering is still the same!
So textfield 3 that had object5 when it renders also uses object5 when the submit is there. So the model must be stable.

johan

Cameron Braid wrote:

The issue that I think will eventuate from this is perforamce related. 

 

If I have a list of 40 items each using a detachable model (based on entity id).  When the request comes back (after a post) there will need to be 40 individual selects to re-attach the listitem models.

 

This is because detachable models seem to be automatically re-attachd automatically at the start of the request  - even if the model isn’t accessed.

 

Would it be possible to have a lazy detachable model, such that it is only re-attached if / when the model is actually accessed ?

 

Cameron

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Johan Compagner
Sent: Wednesday, 9 March 2005 1:53 AM
To: [email protected]
Subject: Re: [Wicket-develop] should we make AbstractResource serializeable or not?

 

The best thing to do is to store hibernate ID (the pk) of the object within youre listitem components.
And then if the request comes back you popuplate youre object again with that pk.

Hibernate objects are also serializeable (the most time) so you could choose for to serialize it..
But keeping hibernate objects over multiple request should be done (you will get transient object exceptions then)

johan

Cameron Braid wrote:

Ok.. I must have done something wrong, because I had a list of objects (that weren’t serializable) in a detachable pageable list model, and I was receiving an exception saying that it wasn’t serializable.

 

How does the case work where I bind the elements in the list to more components.  I presume that I would have to wrap each of them in a detachable model too ?  This is probably where I have gone wrong.

 

For example..

 

Say I have a list of ContactEntity objects (hibernate mapped pojos)

I have a detablable pageable list model of contacts (using a hibernate query and storing the criteria as a non transient property of the list model)

Then to make a grid editor, I bind properties of each contact to TextField inputs.  

Would I need to make a detachable contact model that loads the contact by id and bind it to the form components ?

 

Thanks,

 

Cameron.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Johan Compagner
Sent: Wednesday, 9 March 2005 12:49 AM
To: [email protected]
Subject: Re: [Wicket-develop] should we make AbstractResource serializeable or not?

 

because the model itself will still be serialized.
A detachable model doesn't mean the model itself is detached but the developer can detach the contents.

For example if you have a heavy weight component in your model that you can relookup from somewhere
by an ID. Then in the detach you store that id in a non transient instance reference. And youre heavy weight object
is cleared or hold only in a transient reference.

Then when the component and its model are serialized only the id is serialized with the model not youre complete object.

johan


Cameron Braid wrote:

Speaking about serializable stuff...
 
With detachable models, why do they also have to be serializable ?
 
Cameron.
 
  
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:wicket-develop-
[EMAIL PROTECTED]] On Behalf Of Johan Compagner
Sent: Wednesday, 9 March 2005 12:28 AM
To: Wicket Developer List
Subject: [Wicket-develop] should we make AbstractResource serializeable or
not?
 
Our clone by serialize did encounter a few serialization exceptions for
example
all the Resources (like image). Should we make AbstractResource
serializeable?
those can be in the session..
 
johan
 
 
 
 
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
    
 
 
 
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
 
  


Reply via email to