Re: Pagination query

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 01 2005 - 20:04:05 EST

  • Next message: Andrus Adamchik: "Re: MySQL DATETIME support"

    I am not a big Struts expert, but on Cayenne side it is not that easy
    to accidentally trigger a full fetch (BTW, do you have a Cayenne SQL
    log for this operation?) So the most likely reason is an incorrect use
    of a Struts "iterate" tag - I am 99.9% sure that Cayenne does the right
    thing, and then the view part forces full list resolution.

    A quick way to confirm its Struts is by simply looking on screen - do
    you see more than 25 rows in the browser? If so, then look at how you
    iterate through the data (check Joshua's advise below - I am sure
    that's what it is; also you may search for some Struts examples on how
    to build paginated view from big collections - there should be a lot of
    those out there; and of course ask on Struts mailing list).

    Andrus

    On Mar 1, 2005, at 6:11 PM, Joshua Pyle wrote:

    > Sorry Sami but I don't use the logic:iterate tag. I also use struts
    > but I use my own custom tag to render the results of my queries.
    >
    > Here is a link to the Struts documentation that mentions a length and
    > offest attribute...
    >
    > http://struts.apache.org/userGuide/struts-logic.html#iterate
    >
    > My advise is you experiment with those two attributes and see what you
    > get.
    >
    > On Tue, 01 Mar 2005 16:16:48 -0500, Sami Mohammed
    > <SMOHAMME..ndependenthealth.com> wrote:
    >> Hi joshua,
    >>
    >> Thank you.
    >>
    >> I am using struts iterate tag to display.
    >> see the code BELOW:
    >>
    >> <logic:iterate id="display" name="DisplayResult">
    >> <bean:write name="display" property="name"/>
    >> </logic:iterate>
    >>
    >> In action class i Stored the Display object into the request object
    >> like this
    >>
    >> request.setAttribute("DisplayResult", cwViewBean);
    >>
    >> anything i have to do with iterate tag to limit the rows, since i
    >> already limit the pageSize to 25 in action class.
    >>
    >> if you have any idea pls let me know.
    >>
    >> thanks
    >> sami
    >>
    >> CONFIDENTIALITY NOTICE. This e-mail and attachments, if any, may
    >> contain confidential information which is privileged and protected
    >> from disclosure by Federal and State
    >> confidentiality laws rules and regulations. This e-mail and
    >> attachments, if any, are intended for the designated addressee only.
    >> If you are not the designated addressee, you
    >> are hereby notified that any disclosure, copying, or distribution of
    >> this e-mail and its attachments, if any, may be unlawful and may
    >> subject you to legal consequences. If you
    >> have received this e-mail and attachments in error, please contact
    >> Independent Health immediately at (716) 631-3001 and delete the
    >> e-mail and its attachments from your
    >> computer. Thank you for your attention
    >>
    >>>>> joshua.t.pyl..mail.com 03/01/05 03:33PM >>>
    >> It might help Sami if you did not comment out the following 2 lines...
    >>
    >> // adding paging functionality
    >> //cwTableParamMap.put(Constants.CW_REQ_PARAM_PAGE_SIZE, new
    >> Integer(mPageSize));
    >> //cwTableParamMap.put(Constants.CW_REQ_PARAM_CURRENT_ROW, new
    >> Integer(mCurrentRow));
    >> // adding paging functionality
    >>
    >> I don't know this crosswalk thing but you seem to have commented out
    >> the controls that would limit your paging. The way cayenne does its
    >> paging is that it will only query the data on a per page basis but if
    >> your code loops through all of the data it will retrieve all of the
    >> data.
    >>
    >> It appears that your cntrols to limit the looping of your result list
    >> is not in place.
    >>
    >> Once again I do not know crosswalk so take my answer with that grain
    >> of salt.
    >>
    >> On Tue, 1 Mar 2005 13:47:20 -0500 (EST), Andrus Adamchik
    >> <andru..bjectstyle.org> wrote:
    >>> Sami,
    >>>
    >>> I understand that you are stuck at the moment. But please don't
    >>> repost
    >>> your question over and over again. Somebody (maybe myself) will look
    >>> at
    >>> it, just give it some time. That's the nature of free support -
    >>> people are
    >>> willing to give their time to community, but you shouldn't push too
    >>> hard.
    >>>
    >>> Andrus
    >>>
    >>>
    >>>> HI
    >>>>
    >>>> any body help me .
    >>>> page reterives all the rows from the table.
    >>>> see code below
    >>>>
    >>>>
    >>>> SelectQuery
    >>>> cwDataQuery
    >>>> = new
    >>>> SelectQuery(cwClass);
    >>>>
    >>>> cwDataQuery.addOrderings(cwObject.getViewOrderings());
    >>>> //cwDataQuery.setFetchLimit(100);
    >>>> cwDataQuery.setPageSize(25); //
    >>>> HERE I AM SETTING PAGE SIZE =25
    >>>> BUT STILL ITS RETRIVING ALL THE ROWS FROM THE TABLE WHATS THE
    >>>> PROBLEM
    >>>>
    >>>>
    >>>> // Perform the query
    >>>> List resultList =
    >>>> context.performQuery(cwDataQuery);
    >>>> THANKS
    >>>> SAMI
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >> --
    >> Joshua T. Pyle
    >> Go has always existed.
    >>
    >>
    >
    >
    > --
    > Joshua T. Pyle
    > Go has always existed.
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 01 2005 - 20:04:12 EST