Your QueryDetachableModel will break under clustering.  The transient
"instance" Object will become null when the container deserializes it and
your load method will be unable to reload the object.  

If you're using these QueryDetachableModels, yes, the object instance is
being stored in your session.  But no, it will not be replicated correctly.

If you really want to make the memory impact disappear as well as the
clustering bandwidth, you would need to use a transient SoftReference and
take the hit of implementing a load method which reads your object from some
kind of object storage (or cache).

There is no free lunch.  You are ultimately stuck with a tradeoff: either
use the memory and/or bandwidth OR be prepared to pay the price of loading
the object from storage.


carloc wrote:
> 
> Hi, I would like to ask this.
> 
> Are my objects still being stored in the session when I use this kind of
> query.
> I don't requery the objects using a  detachable model.
> 
> package com.ccti.web.query;
> 
> import org.apache.wicket.model.LoadableDetachableModel;
> 
> public class QueryDetachableModel extends LoadableDetachableModel {
>       private transient Object instance;
>       
>       public QueryDetachableModel(Object instance) {
>               this.instance = instance;
>       }
>       @Override
>       protected Object load() {
>               // TODO Auto-generated method stub
>               return instance;
>       }
> 
> }
> 
> Here's how my DataProvider looks like.
> 
> 
> public class QueryDataProvider extends SortableDataProvider {
>       
>       /**
>        * 
>        */
>       private transient QueryCommand queryCommand;
>       
>       public QueryDataProvider(QueryCommand queryCommand) {
>               this.queryCommand = queryCommand;
>       }
> 
>       /* (non-Javadoc)
>        * @see
> org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int)
>        */
>       public Iterator iterator(int first, int count) {
>               // TODO Auto-generated method stub
> 
>               setQueryLimits(first, count);
>               return queryCommand.execute();
>       }
> 
>       /**
>        * @param first
>        * @param count
>        */
>       private void setQueryLimits(int first, int count) {
>               // can't be set anywhere else but here.
>               queryCommand.setPageIndex(first);
>               queryCommand.setPageSize(count);
>       }
> 
>       public IModel model(Object object) {
>               // TODO Auto-generated method stub
>               return new QueryDetachableModel(object);
>       }
> 
>       public int size() {
>               // TODO Auto-generated method stub
>               return queryCommand.queryCount();
>       }
> 

-- 
View this message in context: 
http://www.nabble.com/Question-With-Detachable-Models-tf4446686.html#a12687670
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