cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: SQLSelect: Getting fluent… WDYT?
Date Sat, 25 May 2013 10:39:11 GMT

On May 25, 2013, at 10:33 AM, Aristedes Maniatis <ari@maniatis.org> wrote:


> however I am confused by columnNameCaps(). This seems to be something you'd want to set
in the data model rather than per query. Or could Cayenne just perform a case insensitive
match to the db model and then adjust the case as needed, all without specifying anything.

Guessing it in Cayenne would be ideal. The feature itself dates back to SQLTemplate, but the
new API is all about making things easier. The goal of this feat is to be able to convert
DataRow to object, so we presumably know the entity involved and can make a good guess.

> Also, does it make sense to allow the bindings within the query method as an option:
> 
>    SQLSelect.query(Artist.class, "SELECT * FROM Artists WHERE name = $name", "name",
"fred")
> 
> That's a bit like printf style calls (although it references replacements by position
rather than name).

Yeah, I'd say we should start supporting positional parameters (and we do in EJBQL, but not
in SQLTemplate or Expression). Then it will work with a vararg method.


> Would it be possible to write aggregate queries:
> 
>    int count = SQLSelect.scalar(Artist.class, "SELECT COUNT(*) FROM Artists WHERE name
= $name").bind("name", "fred").value()

Good idea. It should be easy to do.

Andrus


Mime
View raw message