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-1967) Deprecate SQLTemplate parameter batches
Date Sun, 02 Nov 2014 10:42:33 GMT

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

Andrus Adamchik updated CAY-1967:
---------------------------------
    Description: 
One of the hurdles in creating a cleaner API for SQLTemplate is its support for parameter
batches:

SQLTemplate template = ...

Map<String, Object>[] params = new Map<>[2];
params[0] = ..
params[1] = ..

sqlTemplate.setParams(params);

There's a very small performance benefit to using batches, as PreparedStatement is not precompiled
between the batch bindings. So switching this form instance to QueryChain is not going to
have much effect on speed, but makes things cleaner:

SQLTemplate template = ...;
Query[] queries = new Query[2];
queries[0] = template.queryQueryWithParameters(..);
queries[1] = template.queryQueryWithParameters(..);

QueryChain chain = new QueryChain(queries);

So going to deprecate parameter batches. 

  was:
One of the hurdles in creating a cleaner API for SQLTemplate is its support for parameter
batches:

SQLTemplate template = ...

Map<String, Object>[] params = new Map<>[2];
params[0] = ..
params[1] = ..

sqlTemplate.setParams(params);

There's a very small performance benefit to using batches vs. say using QueryChain:

SQLTemplate template = ...;
Query[] queries = new Query[2];
queries[0] = template.queryQueryWithParameters(..);
queries[1] = template.queryQueryWithParameters(..);

QueryChain chain = new QueryChain(queries);

Probably not noticeable enough by anyone. So going to deprecate parameter batches. 


> Deprecate SQLTemplate parameter batches
> ---------------------------------------
>
>                 Key: CAY-1967
>                 URL: https://issues.apache.org/jira/browse/CAY-1967
>             Project: Cayenne
>          Issue Type: Improvement
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>
> One of the hurdles in creating a cleaner API for SQLTemplate is its support for parameter
batches:
> SQLTemplate template = ...
> Map<String, Object>[] params = new Map<>[2];
> params[0] = ..
> params[1] = ..
> sqlTemplate.setParams(params);
> There's a very small performance benefit to using batches, as PreparedStatement is not
precompiled between the batch bindings. So switching this form instance to QueryChain is not
going to have much effect on speed, but makes things cleaner:
> SQLTemplate template = ...;
> Query[] queries = new Query[2];
> queries[0] = template.queryQueryWithParameters(..);
> queries[1] = template.queryQueryWithParameters(..);
> QueryChain chain = new QueryChain(queries);
> So going to deprecate parameter batches. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message