cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAY-1828) SQLSelect - generics friendly selecting raw sql query
Date Fri, 24 May 2013 15:32:19 GMT

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

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

    Description: 
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);



  was:
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:

q1.fetchLimit(2).fetchOffset(4).upperColumnNames();

    
> SQLSelect - generics friendly selecting raw 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

Mime
View raw message