This is something I wanted to improve as well, and as you correctly pointed out, data rows option makes it hard... There are a few other stumbling blocks as well, such as the new scalar or mixed scalar/ object queries, updating queries, etc.

The more I think about it, the more I feel like we'll have to do some kind of Context/Query wrapper that supports generics specifically for select queries, similar to what was suggested here:

https://issues.apache.org/cayenne/browse/CAY-877

With EJBQL support by Cayenne, we can include a bunch of interesting functions in such wrapper (such as aggregates, etc.)

Andrus


On Dec 21, 2007, at 11:41 AM, Tore Halset wrote:
Hello.

I typically do a lot of

SelectQuery query = new SelectQuery(MyEntity.class, qual);
List entities = ctxt.performQuery(query);

What I want instead is something like

SelectQuery<MyEntity> query = new SelectQuery<MyEntity>(qual);
List<MyEntity> entities = ctxt.performQuery(query);

How can I get rid of the "MyEntity.class, " argument to the SelectQuery constructor? What about SelectQuery#setFetchingDataRows that changes the expected return type?
What do you think?

Regards,
- Tore.


Reply via email to