Your best bet is using SQLTemplate in this case. Not as OO as SelectQuery, but 
certainly not a stored procedure either :)

http://cayenne.apache.org/doc30/sqltemplate-query.html

Cheers,
Andrus

On Mar 14, 2012, at 4:22 PM, Emerson Castañeda wrote:

> HI everyone
> 
> I have a table with a timestamp field, so  I'm thinking about how to write
> the next query without define a store procedure, but directly from my java
> code:
> 
> select *
> from  table1
> where
> id = 1 and
> extract(day from timestampField)='04' and
> extract(month from timestampField)='04' and
> extract(year from timestampField)='2009'
> 
> I'd like to know if that is possible using cayenne, maybe some thing like
> this?
> 
> 
> SelectQuery query = new SelectQuery(Table1.class);
> query.andQualifier(<??EXPRESSION???>)
> 
> OR
> 
> SelectQuery query = new SelectQuery(Table1.class);
> query.andQualifier( ExpressionFactory.likeIgnoreCaseExp(
>                        Table1.timestampproperty, "%"));
> 
> 
> Thank you for your time
> 
> EMERSON

Reply via email to