Comparing two Dates in cayenne

From: Dhruti Ramani (dhrutiraman..ahoo.com)
Date: Mon Apr 25 2005 - 17:48:06 EDT

  • Next message: Filip Balas: "Re: Hierarchical relationship problems"

    Hi,
     
    I am using cayenne1.1 and postgresql7.* for as database. I have to get all the rows from Deal table which has value of field "dateIn"(Date) between startDate and endDate. The code I have used is this,
     
    DateFormat df=DateFormat.getDateInstance(DateFormate.SHORT);
    Date d1=df.parse(startDate);
    Date d2=df.parse(endDate);
    // to get in this format ::: query=dateIn > 'startDate' and dateIn < 'endDate'
    query="dateIn "+" > "+"'"+startDate+"'"+" and "+"dateIn"+" < "+"'"+endDate+"'";
    Expression e=Expression.fromString(query);
    SeleceQuery q=new SelectQuery(Deal.class,e);
    List alist=dataContext.performQuery(q);
     
    But this returns the empty list even if the dataIn value is between the specified range. If I use the same SQL format directly into postgersql it returns the value.
     
    Am I doing something wrong?
     
    Thanks,
    Denna

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com



    This archive was generated by hypermail 2.0.0 : Mon Apr 25 2005 - 17:48:08 EDT