-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch binding is broken if type is not constant for all bindings for the same name #1901
Comments
Hi, generally PreparedBatch gains efficiency by assuming that all bound parameter types for each batch is the same. |
I solved this issue in my code temporarily by using multiple PreparedBatches, but definitely subscribing to this thread because as I add complexity to my entities I don't know if separating the batches to account for nulls will still be efficient. At the moment, I have 3 nullable SQL bindings. In the future, I could have 10 or 20 or 30, and for every nullable binding I would need an individually crafted batch, which quickly adds up. This is my temporary workaround. It's a little ugly...
|
We are pretty much stuck on older JDBIs (around 3.9) for the same reason fwiw @stevenschlansker - any mixtures of bindNull and bind anything else seems to blow up. All with a classcast exception to whatever type it thinks would be best (probably the first bound type) |
I haven't forgotten about this issue - I had some vacation run into a busy time at work. I'll try to get some attention here soon. Sorry it's taking a bit. |
@merzbird @The-Funk @mikebell90 this should be fixed in |
Aaaaah! Thank you so much for everything y'all do! I can't wait to implement this in my code! This is going to make a handful of methods much cleaner looking and more readable. |
Reproduced with the latest
3.20.1
version.When using prepared batch and bind the same binding with different types (e.g. boolean and NULL type), exception is thrown.
Code:
Exception:
The text was updated successfully, but these errors were encountered: