Browse Source

Polishing.

Refining documentation.

Original pull request #2008
pull/1956/head
Jens Schauder 9 months ago
parent
commit
a7a9fbca5d
No known key found for this signature in database
GPG Key ID: 74F6C554AE971567
  1. 6
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/StringBasedJdbcQuery.java
  2. 10
      src/main/antora/modules/ROOT/pages/jdbc/transactions.adoc

6
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/StringBasedJdbcQuery.java

@ -140,8 +140,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery { @@ -140,8 +140,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
* @since 3.4
*/
public StringBasedJdbcQuery(JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations,
RowMapperFactory rowMapperFactory, JdbcConverter converter,
ValueExpressionDelegate delegate) {
RowMapperFactory rowMapperFactory, JdbcConverter converter, ValueExpressionDelegate delegate) {
this(queryMethod.getRequiredQuery(), queryMethod, operations, rowMapperFactory, converter, delegate);
}
@ -158,8 +157,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery { @@ -158,8 +157,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
* @since 3.4
*/
public StringBasedJdbcQuery(String query, JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations,
RowMapperFactory rowMapperFactory, JdbcConverter converter,
ValueExpressionDelegate delegate) {
RowMapperFactory rowMapperFactory, JdbcConverter converter, ValueExpressionDelegate delegate) {
super(queryMethod, operations);
Assert.hasText(query, "Query must not be null or empty");
Assert.notNull(rowMapperFactory, "RowMapperFactory must not be null");

10
src/main/antora/modules/ROOT/pages/jdbc/transactions.adoc

@ -101,10 +101,6 @@ The required value of type `LockMode` offers two values: `PESSIMISTIC_READ` whic @@ -101,10 +101,6 @@ The required value of type `LockMode` offers two values: `PESSIMISTIC_READ` whic
Some databases do not make this distinction.
In that cases both modes are equivalent of `PESSIMISTIC_WRITE`.
NOTE: It is worth stating explicitly, that `@Lock` currently is not supported on string-based queries. It means,
that queries in the repository, created with `@Query`, will ignore the locking information provided by the `@Lock`,
Using `@Lock` on string-based queries will result in the warning in logs.
.Using @Lock on derived query method
[source,java]
----
@ -123,3 +119,9 @@ If you are using a databse with the MySQL Dialect this will result for example i @@ -123,3 +119,9 @@ If you are using a databse with the MySQL Dialect this will result for example i
----
Select * from user u where u.lastname = lastname LOCK IN SHARE MODE
----
NOTE: `@Lock` is currently not supported on string-based queries.
Query-methods created with `@Query`, will ignore the locking information provided by the `@Lock`,
Using `@Lock` on string-based queries will result in the warning in logs.
Future versions will throw an exception.

Loading…
Cancel
Save