You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2013/05/24 17:34:35 UTC

[jira] [Updated] (CAY-1828) SQLSelect - generics friendly fluent selecting sql query

     [ https://issues.apache.org/jira/browse/CAY-1828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik updated CAY-1828:
---------------------------------

    Summary: SQLSelect - generics friendly fluent selecting sql query  (was: SQLSelect - generics friendly selecting raw sql query)
    
> SQLSelect - generics friendly fluent selecting sql query
> --------------------------------------------------------
>
>                 Key: CAY-1828
>                 URL: https://issues.apache.org/jira/browse/CAY-1828
>             Project: Cayenne
>          Issue Type: Bug
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.2M1
>
>
> Want to have something more usable than SQLTemplate... Its routing defaults, parameter bindings, etc. etc. are just not that user-friendly. So creating a simpler selecting version that will internally translate to SQLTemplate.
> Here are construction examples:
> SQLSelect<DataRow> q1 = SQLSelect.dataRowQuery("SELECT * FROM x");
> SQLSelect<Artist> q2 = SQLSelect.query(Artist.class, "SELECT * FROM x"); 
> List<DataRow> l1 = context.select(q1);
> Also use fluent API... some examples from unit tests:
> 1. Complete fluent select:
> List<Artist> result = SQLSelect.query(Artist.class, "SELECT * FROM ARTIST WHERE ARTIST_NAME = #bind($a)")
>                 .bind("a", "artist3").select(context);
> 2. Selecting a single object:
>  Artist a = SQLSelect.query(Artist.class, "SELECT * FROM ARTIST WHERE ARTIST_NAME = #bind($a)")
>                 .bind("a", "artist3").selectOne(context);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira