db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Guillemot" <mguille...@yahoo.fr>
Subject Re: Query on date field: pb with Criteria.addDate
Date Tue, 07 Jan 2003 15:50:39 GMT
Does someone use Criteria.addDate?
I'm always stuck with this problem.

Marc.

----- Original Message -----
From: "Marc Guillemot" <mguillemot@yahoo.fr>
To: <turbine-torque-user@jakarta.apache.org>
Sent: Friday, December 20, 2002 6:31 PM
Subject: Query on date field: pb with Criteria.addDate


> Hi,
>
> I  want to perform a doSelect with a criteria on a date field.
> I've tryed
>     Criteria.addDate
> and
>     Criteria.add with a GregorianCalendar as parameter
> but in both cases I get an sql error (I use MySQL with the
> org.gjt.mm.mysql.Driver driver) because the generated sql query just
> contains the toString() representation of the GregorianCalendar:
>
> SELECT Tasks.ID, Tasks.WORKERID, Tasks.STARTDATE, Tasks.ENDDATE,
> Tasks.PAUSE, Tasks.DESCRIPTION, Tasks.COMMENT, Tasks.STATUS,
> Tasks.VALIDATORID, Tasks.VALIDATIONDATE FROM Tasks WHERE
>
Tasks.ENDDATE<=java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllF
>
ieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berli
>
n",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRu
>
le=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=36000
>
00,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDa
>
yOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,e
>
ndDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysIn
>
FirstWeek=4,ERA=1,YEAR=2002,MONTH=11,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_M
>
ONTH=1,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=?,HOUR=?,HOU
> R_OF_DAY=?,MINUTE=?,SECOND=?,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?]
>
> Does Torque provide a way to perform a query with criteria on date fields?
>
> Marc.




Mime
View raw message