The results of a batch execution are beyond our control, just when you call
Query.execute(), the resulting int value is not jOOQ's to produce. The JDBC
specification specifies what should be the result of
Statement.executeUpdate() calls, and the individual int[] values of a
executeBatch() call. You will have to refer to your JDBC driver's
documentation to learn what -2 means.

I hope this helps,
Lukas

On Fri, Mar 6, 2020 at 3:40 AM Joe Bassil <[email protected]> wrote:

> Here's the code snippet.
>
> Query query = dslContext.insertInto("TABLENAME")
>                         .set("COLUMN1",(Long) null)
>                         .set("COLUMN2",(Long) null)
>                         .set("COLUMN3",(Integer) null)
>                         .set("COLUMN4",(String) null)
>                         .set("COLUMN5",(Integer) null)
>                         .set("COLUMN6",(Long) null);
> BatchBindStep batch = dslContext.batch(query);
> for (Object obj : arrOfObjects) {
>   batch = batch.bind(obj.getVariable1(), obj.getVariable2(),
>       obj.getVariable3(), obj.getVariable4(), 
> obj.getVariable5(),obj.getVariable6());
>
> }
>
> // although all the data looks to be inserted correctly, -2 is returned in 
> each position of the 'result' array
> int[] result = batch.execute();
>
> E code here...
>
>
>
> On Thursday, 5 March 2020 21:22:40 UTC-5, Joe Bassil wrote:
>>
>> Hi,
>>
>> I have implemented a batch insert operation using the BatchBindStep
>> construct and I am confused by the int array values returned from the
>> BatchBindStep.execute(). I expected to get the record count for each
>> executed batch but instead I am getting a negative number (-2) for each
>> batch execute call instead.  Can someone explain this as I cannot find
>> anything in the documentation to explain this.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/9b75bb1a-9dc4-4458-936c-0a6c732a6574%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/9b75bb1a-9dc4-4458-936c-0a6c732a6574%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO5LQitqSDUc%2Bx0sWp-6rT46niv%3DwKjdxuWf6addYn6_Zg%40mail.gmail.com.

Reply via email to