-
Notifications
You must be signed in to change notification settings - Fork 356
Clarify the @Lock on String-based queries #2008
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
Conversation
Signed-off-by: mipo256 <mikhailpolivakha@gmail.com>
9be3228
to
3d99565
Compare
Original pull request #2008 Signed-off-by: mipo256 <mikhailpolivakha@gmail.com> Commit message edited.
Refining documentation. Original pull request #2008
Thanks. That's merged. And I agree on the error message. Do you want to prepare a PR for the 4.0.x branch? |
@schauder eah, sure. So we want to throw an exception since version 4.0.x, am I correct? If so, then I'll provide the corresponding PR |
Exactly. Thanks. |
@@ -78,6 +80,8 @@ | |||
public class StringBasedJdbcQuery extends AbstractJdbcQuery { | |||
|
|||
private static final String PARAMETER_NEEDS_TO_BE_NAMED = "For queries with named parameters you need to provide names for method parameters; Use @Param for query method parameters, or use the javac flag -parameters"; | |||
private final static String LOCKING_IS_NOT_SUPPORTED = "Currently, @Lock is supported only on derived queries. In other words, for queries created with @Query, the locking condition specified with @Lock does nothing"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to reword the second part from a repetition to something actionable? I.e. "…include the database-specific locking hints in your query…"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I agree with you, @mp911de. I'll provide the PR with exception thrown for 4th major release shortly, and I'll apply your suggestion, what do you think?
Currently, the reference documentation states, that
@Lock
can be used with derived queries. But our documentation does not mention anywhere, that we do not support@Lock
on string-based queries. I want to address this issue by altering the corresponding doc + issuing the warning logP.S: @mp911de @schauder Maybe we can throw an exception? By the way, we're already actively doing so, check here.
My concern is that this will be a breaking change, although. Nevertheless, this is a fail fast approach, which is generally better. In addition, Spring Data JDBC 4 major release is coming, so, I think it is worth considering this option.