> SQLTemplate query=new SQLTemplate(CashFlow.class,"select * from
> cashflow",true);
> String str="select c.paydate from cashflow c,quote q where
> c.quote_id=q.quote_id AND q.isacceptedQuote='t' ";
> query.setTemplate(DbAdapter.POSTGRES,str);
> List results=dataContext.performQuery(query);
>
> It returns 5 rows which is true but if i try to print those values it
> returns null for all rows.
> Am I doing something wrong?
I think so. I think you actually want:
SQLTemplate query=new SQLTemplate(CashFlow.class,"select * from
cashflow c,quote q where c.quote_id=q.quote_id AND
q.isacceptedQuote='t'";
List results=dataContext.performQuery(query);
The query that is the second argument to SQLTemplate should be the
default query you want to run, in the way you want to run it. The str
that you were passing only returned the date, but it was the one that
Cayenne was using (since you specified it as the query for the
postgres adapter, which will override the default).
I would only ever use setTemplate and override the default if your
application needs to simultaneously support different databases.
Cris
This archive was generated by hypermail 2.0.0 : Fri May 06 2005 - 11:29:01 EDT