cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikita Timofeev (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAY-2470) Can't bind SQLExec parameters in a loop
Date Wed, 05 Sep 2018 09:21:00 GMT

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

Nikita Timofeev updated CAY-2470:
---------------------------------
    Fix Version/s: 4.1.M3
                   4.0.1

> Can't bind SQLExec parameters in a loop
> ---------------------------------------
>
>                 Key: CAY-2470
>                 URL: https://issues.apache.org/jira/browse/CAY-2470
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.1.M2, 4.0
>            Reporter: Andrus Adamchik
>            Assignee: Nikita Timofeev
>            Priority: Minor
>             Fix For: 4.0.1, 4.1.M3
>
>
> I am trying to use SQLExec for batch inserts, reusing the basic query:
> {noformat}
> SQLExec inserter = SQLExec.query("insert into t1 (id) values (#bind($id))");
> for(int i = 0; i < 2; i++) {
>    inserter.paramsArray(i).execute(context);
> }{noformat}
> This works on the first loop iteration, but fails on the second with a duplicate PK error.
Looks like the underlying "replacementQuery" is compiled only once during the first "execute()"
call and is cached on subsequent calls even though the main query settings have changed.
> I suspect this issue affects other subclasses of IndirectQuery as well... We need to
clear their cached state if the settings affecting it change in the main query.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message