You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Bryce Nesbitt <br...@obviously.com> on 2006/07/11 11:53:13 UTC

Torque not passing setLimit() on to mysql?

Our application sets a limit:
             ....
            criteria.setLimit (25);
            List results = CcsReservationPeer.doSelect(criteria);
            logger.debug("Searching up to " + criteria.getLimit() +
            " reservations: " + criteria.toString());


The debug shows the limit:

1827924 [tcpConnection-8080-3] DEBUG sql.SQLReservationManager  -
Searching up to 25 reservations:
Criteria::
XXX_RESERVATION.STOP<=>(XXX_RESERVATION.STOP>='20060711023000' AND
XXX_RESERVATION.STOP<='20060711043000'): 
XXX_RESERVATION.CLASS_ID<=>XXX_RESERVATION.CLASS_ID IN
(4,2,6,12,11,5,9,10,8,1,7,3):
Current Query SQL (may not be complete or applicable):
SELECT  FROM XXX_RESERVATION WHERE
(XXX_RESERVATION.STOP>='20060711023000' AND
XXX_RESERVATION.STOP<='20060711043000') AND XXX_RESERVATION.CLASS_ID IN
(4,2,6,12,11,5,9,10,8,1,7,3) ORDER BY XXX_RESERVATION.START DESC LIMIT 25


But it does NOT show up in the mysql query log:
060711  2:35:45       1 Query       SELECT 1
                      1 Query       SET autocommit=1
                      1 Query       SELECT
XXX_RESERVATION.RESERVATION_ID, XXX_RESERVATION.MEMBER_ID,
XXX_RESERVATION.ASSIGNMENT_ID,  XXX_RESERVATION.SURVEY FROM
XXX_RESERVATION WHERE (XXX_RESERVATION.STOP>='20060711023000' AND
XXX_RESERVATION.STOP<='20060711043000') AND XXX_RESERVATION.CLASS_ID IN
(4,2,6,12,11,5,9,10,8,1,7,3) ORDER BY XXX_RESERVATION.START DESC


And, of course, it does not work.  This is an older Torque, with a
modern mysql 4.1.  Any ideas what I may be doing wrong?


-- 
----
Visit http://www.obviously.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Torque not passing setLimit() on to mysql?

Posted by Bryce Nesbitt <br...@obviously.com>.
Thomas Vandahl wrote:
> Bryce Nesbitt wrote:
>> And, of course, it does not work.  This is an older Torque, with a
>> modern mysql 4.1.  Any ideas what I may be doing wrong?
>
> What version of Torque are you using? This feature has been available
> for ages. Could you please post your Torque.properties?
If found the issue:

            criteria.setLimit (listForm.getLimit());    // The debug
statement
            criteria.setOffset(listForm.getOffset());   // messes up the
setLimit() call
            if( logger.isDebugEnabled() ) {
                logger.debug("Criteria: limit=" + criteria.getLimit() +
                            " offset=" + criteria.getOffset() +
                             "\ntoString: " + criteria.toString());
            }
            criteria.setLimit (listForm.getLimit());    // The debug
statement
            criteria.setOffset(listForm.getOffset());   // messes up the
setLimit() call
            List results = CcsReservationPeer.doSelect(criteria);

The logger.debug() statement somehow messes up the setLimit, as if
reading criteria.toString() clears the limit.  This is with
torque-3.0-b4 (on a legacy application).  Yes, you read correctly, beta 4.

-- 
----
Visit <a href="http://www.obviously.com/">obviously</a>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Torque not passing setLimit() on to mysql?

Posted by Thomas Vandahl <tv...@apache.org>.
Bryce Nesbitt wrote:
> And, of course, it does not work.  This is an older Torque, with a
> modern mysql 4.1.  Any ideas what I may be doing wrong?

What version of Torque are you using? This feature has been available 
for ages. Could you please post your Torque.properties?

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org