You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "david.wynter@btclick.com" <da...@btclick.com> on 2002/01/15 16:23:59 UTC

Error selecting using Criteria where Date type used

I am attempting to use a Criteria to select rows from the database where the
restriction clause uses the Date type. I had a look at the code for
Turbine_User as it uses a Date (Turbine_user.created) and it sets the value
using a java.util.Date object. When I try the same thing with the following
code I get a  "ORA-01858: a non numeric character was found where a numeric
was expected" error.

Both startsearchdate and endsearchdate below are of type java.util.Date

		Criteria crit = new Criteria();
            crit.add(RwRetrievalPeer.SCHEDULE_ID,
                     KeyConverter.numberKeyFromInt(scheduleId));
            crit.add(RwRetrievalPeer.TIME_OF_RETRIEVAL,
                     startsearchdate, Criteria.GREATER_THAN);
            Criteria.Criterion criterion =
crit.getCriterion(RwRetrievalPeer.TIME_OF_RETRIEVAL);
            criterion.and(crit.getNewCriterion(
                             criterion.getTable(),
                             criterion.getColumn(),
                             endsearchdate,
                             crit.LESS_EQUAL ));

crit.addAscendingOrderByColumn(RwRetrievalPeer.TIME_OF_RETRIEVAL);
            Vector rwRetrievals = RwRetrievalPeer.doSelect(crit);

any ideas?

David


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>