db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dionisius Purba" <Dionisius.Pu...@mitrais.com>
Subject URGENT: Creating TWO Criteria on SINGLE column fails
Date Fri, 24 Jun 2005 04:27:56 GMT
Hi, plese help, I'm a Torque's newbie.
I think I do something stupid here.

I need to create the following SQL: 
select * from transaction where creation_date > ? & creation_date < ?

therefore I make the following criteria building:
Criteria myCriteria = new Criteria();

Timestamp tsStart = new Timestamp(TransactionPeer.createCalendar(dateStart, hhmm).getTimeInMillis());
myCriteria.add(TransactionPeer.CREATED_DATE, tsStart, Criteria.GREATER_EQUAL);		

Timestamp tsEnd = new Timestamp(TransactionPeer.createCalendar(dateEnd, hhmmEnd).getTimeInMillis());
myCriteria.add(TransactionPeer.CREATED_DATE, tsEnd, Criteria.LESS_EQUAL);		

if (rfidId != -1) {
	myCriteria.add(TransactionPeer.STATUS, 1, Criteria.EQUAL);	

You can see there are two (not one) criteria there, GREATER_EQUAL and LESS_EQUAL
but it seems that only one of two is used as shown in the log generated by Torque

SELECT COUNT(transaction.ID) FROM transaction WHERE transaction.CREATED_DATE>='20050624080011'
AND transaction.STATUS=1 

Notice that the second criteria (STATUS) is successfully constructed, but not the 2nd CREATED_DATE.
Please help with this quickly. 
Thanks a lot in advance.

Dionisius Purba 
Software Engineer

Mitrais Software Development Center 
Tel : +62 361 755025 
Fax: +62 361 755024 
Visit our website <<<http://www.mitrais.com/>>> 

This transmission is for the intended addressee only and is confidential information. 
If you have received this transmission in error, please delete it and notify the sender. 
The contents of this E-mail are the opinion of the writer only 
and are not endorsed by PT MITRAIS unless expressly stated otherwise.

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