Hi-
I've already fixed my problem, but I have run across this a few times, and its always confusing. It's confused a couple other people that use Jooq on my team too so I'm curious if there are plans to improve it. Also, I'm on 3.3.x so maybe its already better and I just need to upgrade!
Here's the query:
AmlBsaReports abr = Tables.AML_BSA_REPORTS;
BatchBindStep batch = create.batch(create
.update(abr)
.set(abr.STATUS, statusType.getCode())
.set(abr.REF_MERGED_REPORT_ID, mergedReportId)
.where(abr.REPORT_ID.eq((Long) null))
);
for (..something...) {
batch.bind(report.getId()); // add another query to the batch with a particular parameter
}
batch.execute();
So there's a mix of literals and "null" placeholders for bind parameters. The above fails with an unpleasant:
java.lang.ArrayIndexOutOfBoundsException: 1
at org.jooq.impl.BatchSingle.executePrepared(BatchSingle.java:145)
at org.jooq.impl.BatchSingle.execute(BatchSingle.java:111)
Obviously, when I pass all of the params in the bind method it works, but it's inconvenient. Another place where this was even more confusing is in a MERGE query that uses the "dual" table -- apparently under the covers (at least for tsql) that generates a select 1 -- and apparently that '1' needs to be passed in to the bind otherwise it throws a similar exception. Can we get named parameters in the future?
Also a helper method to pass the nulls without the casting would be nice. It gets a little ugly with a few different types. Some method even just called param() or something that passed some type that would unambiguously resolve so we didn't have to keep casting null?
Lastly, any update on the feature to allow you to "collect" updates in a batch until a transaction boundary. i.e. some kind of "automatic" buffering & batching? I know you have some thoughts around it and have a github issue. Just curious on any expectation of what version you were targeting.