turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leon Messerschmidt" <l...@opticode.co.za>
Subject Re: Criteria - select between 2 dates
Date Wed, 05 Sep 2001 11:41:58 GMT
Hi Matt,

That is because the queries of BasePeer is not prepared statements at this
stage.  I added some experimental code that does in fact use prepared
statements.  You can just replace all the BasePeer.doSelect() with
BasePeer.doPSelect() in your generated Base*Peer classes.  I admit it is not
the best way to go, but that is all I have at the moment.

~ Leon

----- Original Message -----
From: "Matthew Forder" <forderm@ams.neth.seagate.com>
To: <turbine-user@jakarta.apache.org>
Sent: Wednesday, September 05, 2001 8:43 AM
Subject: Criteria - select between 2 dates


> I'm trying to build a query where records are selected when a column
> containing a date falls between 2 user supplied dates. The code I'm
> using looks something like this (the names have been changed to protect
> the innocent):
>
> Criteria criteria = new Criteria();
> Vector victor = new Vector();
> Criteria.Criterion a = criteria.getNewCriterion(SomePeer.CREATED_DATE,
> new GregorianCalendar(fyy, fmm, fdd), Criteria.GREATER_EQUAL);
> Criteria.Criterion b = criteria.getNewCriterion(SomePeer.CREATED_DATE,
> new GregorianCalendar(tyy, tmm, tdd), Criteria.LESS_EQUAL);
> criteria.add(a.and(b));
> victor = SomePeer.doSelect(criteria);
>
> However, when I try to execute the query, the SQL that is being
> generated contains (what looks like) a serialized copy of the
> GregorianCalendar objects, rather than something that looks like a date.
>
> Reading from the Turbine API and looking at the source code for
> org.apache.turbine.util.db.Criteria I think I'm taking the right
> approach, but of course on the other hand I'm probably doing something
> dumb.
>
> Any help on this one is appreciated!!
>
> Thanks and regards,
>
> Matt
>
> --
>    ____  | Matthew J. Forder         | Data Center Supervisor
>   / / () | Seagate Techology         | Tel:+31 20 316 7468
>   \ \ \  | Koolhovenlaan 1           | Fax:+31 20 653 5537
>  ()_/_/  | 1119 NB Schiphol-Rijk, NL | matthew.forder@seagate.com


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org


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


Mime
View raw message