i dont really get what the problem is

iterator() loads the list of employee instances

in model() you give each of your detachable models an instance of the
employee, so during that request the model doesnt need to load
anything because its already there...

-igor

On Thu, May 29, 2008 at 1:31 PM, nanotech <[EMAIL PROTECTED]> wrote:
>
> Thanks Igor for your reply.
>
> So, what do you suggest I should do:
>
> 1. After making the call in iterator() method Should I store the result
> object (Employee object ) in EmployeeDAO and then refer it later when I call
>        public IModel model(Object object) {
>                return new DetachableEmployeeModel((Employee)object);
>        }
> and then look it up (by employee Id) from that stored object?
>
> 2. Do I need to take care of synchronization when I store the object?
>
> Any other suggestions?
>
> Thanks,
> RG
>
>
>
>
>
> igor.vaynberg wrote:
>>
>> On Thu, May 29, 2008 at 12:09 PM, nanotech <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi,
>>> I have a search form (in a panel)with various search fields(as text
>>> fields)
>>> on it. User should be able to fill in any number of search parameters
>>> and
>>> the results are to be displayed in table (with pagenation + sorting
>>> capablity on columns) in a different panel on the same page under the
>>> search
>>> panel.
>>>
>>> I started looking at DataTable. It seems a option that will solve my
>>> need.
>>>
>>> Looking at the datatable example on
>>> http://www.wicket-library.com/wicket-examples/repeater/
>>>
>>> I observed that the following methods get called in the order
>>>
>>> 1. size() from CustomSortableDataProvider.
>>> 2. iterator() from CustomSortableDataProvider
>>> 3. load() from CustomLoadableDetachableModel.
>>>
>>> If I understand it correctly:-(Please  correct me if I am wrong)
>>>  * size() requires , the number of records that provider will be working
>>> with. So, in above case i'll have to make query thrrough service layer
>>> /DAO
>>> like this  Select count(*) from Employees where  firstName Like 'ABC' and
>>> lastName Like 'XYZ'
>>>
>>> * iterator(final int first, final int count) will call Service layer/DAO
>>> to
>>> do the actual query like this  Select * from Employees where firstName
>>> Like
>>> 'ABC' and lastName Like 'XYZ'
>>>
>>> * finally in model ...I will call the CustomLoadableDetachableModel and
>>> its
>>> load() method will load the actual Employee model  for each item that
>>> will
>>> be displayed on first page of the list being rendered in data table.
>>>
>>>
>>> It seems that there are too many queries in case of datatable. If the
>>> result
>>> set has thousands of records and we are displaying 100 per page then it
>>> will
>>> do 100+ queries to render all the items.
>>>
>>> Questions:
>>> 1. Did I sum up about DataTable correctly?
>>
>> no, there are only two queries per page render of datatable.
>>
>>> If yes, Won't this be a
>>> bottleneck considering the number of queries?
>>
>>> 2. Is there a better way of doing this?
>>
>> not until someone finds one.
>>
>> -igor
>>
>>>
>>> Thanks,
>>> RG
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Using-DataTable-tp17543606p17543606.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]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Using-DataTable-tp17543606p17545174.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]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to