db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Vanspall" <svansp...@madman.com.au>
Subject weird problem creating sql suery string from criteria
Date Wed, 28 Jun 2006 00:54:35 GMT


I have a problem where If I set criteria add a select column, 95% of the
time getting a SQL query string from the criteria works. But
occasionally it doesn't create a calid SQL string.


This is the code


            // create the count criteria

            Criteria rarCriteria = new Criteria();



            String query = ReturnAuthorisationRequestPeer


            List list = ReturnAuthorisationRequestPeer.executeQuery(



            return ((Record) list.get(0)).getValue(1).asInt();




getReturnAuthorisationRequestSearchCriteria(rarCriteria); just adds the
criteria using the standard Torque methods. add, some criterion and's,
and depending on the conditions a join.



Now when I run this once, with all the same settings it will work.
Occasionally it will throw a SQL syntax error in my sql.


All the conditions fo creating the criteria will be the same as the
previous (succesful) criteria build.


When it fails,
ReturnAuthorisationRequestPeer.createQueryString(rarCriteria) create a
string "Select COUNT(*) FROM" with nothin else. Obvioulsy when it works
it produces the complete SQL string.


Why does Torque selectively create the SQL differently? Is this a bug?
Is there any way to guarantee that this will work every time. Otherwise
I will have ot manually build an SQL string.


Any help would be appreciated






  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message