-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Error retrieving database id results in invalid bound statement when statements are executed #3040
Comments
Hello @p91paul , Thank you for the report and the demo! I only took a quick look, but it seems reasonable to throw |
yes, that would be enough for me. Just to be clear, the main issue is that VendorDatabaseIdProvider currently catches the exception and returns null; it never throws a SqlException. |
As reported in mybatis#3040, swallowing the SQLException could lead to unexpected statement resolution. Theoretically, this change might expose a problem in an existing solution that was previously hidden.
fixed via #3041 |
@p91paul Please try our snapshot now and see if this helps. We typically don't release constantly but if it soles the issue, I'm willing to cut another release as that seems how most projects are these days, bug fix, correct, confirm, release. |
Thanks for fixing it so fast! |
ok thanks @p91paul , glad you have a work around. Its likely we release again before year end and we are fighting with mavens 'site' build and even with little changes we likely will wan to try again but thank you for letting us know its not a super rush wince we have already released twice very quickly and I know many that use bots like Renovate/Dependabot are overwhelmed with releases so we try to be mindful of that. |
Here's what happened to me:
mybatis-3/src/main/java/org/apache/ibatis/mapping/VendorDatabaseIdProvider.java
Line 50 in ca826c5
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
Proposed solutions:
Current workaround: instead of the default VendorDatabaseIdProvider, we decided to inject a subclass where we override getDatabaseId; if super.getDatabaseId() returns null, we throw an exception. This way the application fails and our application orchestrator restarts the application (until the database becomes available again).
Steps to reproduce in attached demo project:
demo-mybatis-invalidbound.zip
The text was updated successfully, but these errors were encountered: