db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Campbell, Justin" <jcampb...@profilesys.com>
Subject AW: Problem with Date in Criteria
Date Wed, 04 Jun 2003 19:33:37 GMT
We got bit with this one over here. The issue is more with MS SQL than with
Torque itself. Torque will print a full date, including milliseconds with an
accuracy beyond the value stored in your table. Try formatting your date as
a string to use only a date (not time, or if time is important, then only
out to seconds).

HTH. Good luck.

- Justin

-----Original Message-----
From: Guillaume Barre [mailto:Guillaume.Barre@technomedia.ca]
Sent: Wednesday, June 04, 2003 3:35 PM
To: 'torque-user@db.apache.org'
Subject: Problem with Date in Criteria


Hello,

I try to use one Date object in a Criteria like in the code below :

	
Iterator iterator1 = TqEntrepriseTypePeer.doSelect(new
Criteria()).iterator();
while(iterator1.hasNext()){
	TqEntrepriseType obj1 = (TqEntrepriseType)iterator1.next();

	System.out.println("getId " + obj1.getId());
	System.out.println("date " + obj1.getAuLastUpdateDate());
	
	Criteria criteria2 = new Criteria();	
	criteria2.add(TqEntrepriseTypePeer.AU_LAST_UPDATE_DATE,
obj.getAuLastUpdateDate() );
	Iterator iterator2 =
TqEntrepriseTypePeer.doSelect(criteria2).iterator();
	while(iterator2.hasNext()){
		TqEntrepriseType obj2 = (TqEntrepriseType)iterator2.next();

		System.out.println("getId(2) " + obj2.getId());
		System.out.println("date " + obj2.getAuLastUpdateDate());
	}
}

My problem is that this code never find the second object "obj2", iterator2
is always empty ???

Notes :
	- obj.getAuLastUpdateDate() return a java.util.Date object

	- My shcema definition for the field AuLastUpdateDate is :
	<column javaName="AuLastUpdateDate" name="AU_LAST_UPDATE_DATE"
required="false" type="TIMESTAMP"/>

	- And I use MSSQL Server

Thanks for any suggestions.
Guillaume


Mime
View raw message