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-2470) Can't bind SQLExec parameters in a loop
Date Mon, 03 Sep 2018 11:54:00 GMT

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

Andrus Adamchik updated CAY-2470:
---------------------------------
    Priority: Minor  (was: Major)

> 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.0
>            Reporter: Andrus Adamchik
>            Assignee: Nikita Timofeev
>            Priority: Minor
>
> 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... 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