Skip to content

Commit 8bade4e

Browse files
committed
Update documentation on native query rewriting.
See #3155 Original pull request: #3353
1 parent 3e9d394 commit 8bade4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/antora/modules/ROOT/pages/jpa/query-methods.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ public interface UserRepository extends JpaRepository<User, Long> {
288288

289289
NOTE: The `@NativeQuery` annotation is mostly a composed annotation for `@Query(nativeQuery=true)` but it also provides additional attributes such as `sqlResultSetMapping` to leverage JPA's `@SqlResultSetMapping(…)`.
290290

291-
NOTE: Spring Data JPA does not currently support dynamic sorting for native queries, because it would have to manipulate the actual query declared, which it cannot do reliably for native SQL. You can, however, use native queries for pagination by specifying the count query yourself, as shown in the following example:
291+
NOTE: Spring Data can rewrite simple queries for pagination and sorting.
292+
More complex queries require either link:https://github.com/JSQLParser/JSqlParser[JSqlParser] to be on the class path or a `countQuery` declared in your code.
293+
See the example below for more details.
292294

293295
.Declare native count queries for pagination at the query method by using `@NativeQuery`
294296
====

0 commit comments

Comments
 (0)