-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Incompatibility between v2 and v3 when using superfluous parameters map #1418
Comments
You'll have to set the flag on the Jdbi/Handle that creates the SqlObject.
As far as I remember, there's no statement customizing annotation like |
Hi @TheRealMarnes, Your code works perfectly :) Thank you! I think this could be described in a JDBI documentation available from www, or in I don't know how to edit documentation, but I can update javadoc if you like. |
You're right, the manual lacks any mention of it. Maybe the exception should mention it as well. I'm not sure why you bring up the javadoc as lacking though; you literally pasted the javadoc, so it exists. If you'd like to start a manual section about it, the manual file is |
@TheRealMarnes, Thank you. Will take a look at the index. In regards to:
Yes, it's there, but it does not describe anything more than what can be read directly from the code. Especially it does not describe how to configure it, and this is the core point of this issue. I found the method in code, I read javadoc, but that's all and after struggling for some time with the code, finding usages etc, I had to ask you, guys, for help. If |
I think you're missing the bigger picture. The |
Well, indeed, it seems I missing it, but the other users are probably missing it as well. It looks to me as quite advanced and kind of a tribal knowledge obvious for core developers but not as obvious for us here in a wild. After you describe it as a standard configuration paradigm I went do JDBI documentation, and after reading it in regards to configuration stuff, I still have just a brief idea how it works. The It's a part of a bigger issue with not all features described in doc in enough details, but we, a JDBI users, are here to help pointing what is missing and help filling the gaps. Therefore, I propose to change javadoc to contain more details, e.g.: /**
* Sets whether or not an exception should be thrown when any arguments are
* given to a query but not actually used in it. Unused bindings tend to be bugs or
* oversights, but can also just be convenient. Defaults to false: unused bindings
* are not allowed.<br>
* <br>
* It can be changed by configuring {@link Configurable} object (e.g. {@link Jdbi}
* or {@link Handle}), for example:
* <pre>
* handle.configure(SqlStatements.class, s -> s.setUnusedBindingAllowed(true))
* </pre>
*
* @see org.jdbi.v3.core.argument.Argument
* @see Handle.configure
* @see Jdbi.configure
*/ I will gladly add it, but please let me know if what I wrote is ok. |
I ran into this exact same deficiency myself this morning. I'm going to prepare a PR that adds |
I'd just like to point out I'm a core member since only like 2 months and I was just a regular user like yourself for over a year before then, so it's not like I'm savvy on the arcane knowledge. 😛 I know most things I know about jdbi by being in your same situation and just exploring and clicking-through on the API and interfaces, letting intellij hint methods at me and such. But yes, it should be clearly documented because we can't expect everyone to inspect jdbi's internals to figure out basic usage. :) I don't think we'll be adding the javadoc the way you suggest though. The config mantra should be dcoumented in its own right, not repeated on every single config setting or included on any one particularly chosen config setting. Each config setting should explain its own effects only. |
We have a section on |
I was reading through Thank you for the |
Guys, I know this is against having configuration paradigm documented in one place, but please consider adding information in the exception message the same way it's done here:
This would save a person who was hit by this exception A LOT of digging in a code :) |
I agree with that much, the exception itself should hint at it. |
@TheRealMarnes hint added in #1428 |
We've added both a hint to the error message, as well as general config documentation with this as a specific example. Hopefully that's a sufficient fix; thanks for using jdbi :) |
Thank you Steven! Take care :) |
Hello @jdbi Team :)
In JDBI v2 we were using construction like this:
The
where
is being build in runtime. In some cases it's empty (simply1 = 1
) and in some cases it contains some values provided by user on GUI filter. For example:With:
Or:
When user provided status in a GUI filter:
Right now, when empty
params
argument is provided, this throws an exception. For example:I found a flag in
SqlStatements
which can be used to allow unused bindings:But I cannot find any way to use this method :( In JDBI source code I found only usages, but no place where it's being set.
I can rewrite our DAOs and introduce new methods which takes no
params
, e.g.:But this would have to be done in a number of existing DAOs and to be honest I would rather like to change one line and magically make it work again.
The text was updated successfully, but these errors were encountered: