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#a12687511
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