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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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 | [EMAIL PROTECTED]


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


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to