Thanks for replying
Yup thanks

I was debugging it and I was able to see it in the session object. meaning
that it is still stored in my object.
I changed the implementation to loading the object.

Now I changed it to loading it from a facade bean.

Thanks


Jonathan Locke wrote:
> 
> 
> I should also add this: although you can do what you will in Wicket, it is
> generally better to use models consistently and reload your objects from
> the DB (this isn't so bad in practice as a lot of the time reloads will
> just hit ehcache or whatever you're using to cache query results and hook
> the object back up again in no time).  It also shrinks the serialization
> overhead and replication bandwidth required to move your objects around in
> the cluster (and with SoftReferenced instance objects it could also
> decrease your non-reclaimable memory load if that matters).  But it is
> also generally helpful to work with reloadable models because they
> automatically avert the more common stale data issues you'll run into.  In
> a multi-user system, this is helpful.  If you've got a Label whose model
> is a PropertyModel on a reloadable PersonModel and someone else changes
> the PersonModel, the expression being retrieved from the model will
> auto-update.  If the label is directly holding the POJO and it's not
> reloadable, the label will continue to display the stale data forever.
> 
> 
> Jonathan Locke wrote:
>> 
>> 
>> 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#a12690353
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