You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/repositories.adoc
+53-1Lines changed: 53 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -741,6 +741,58 @@ A corresponding attribute is available in the XML namespace.
741
741
742
742
This section documents a set of Spring Data extensions that enable Spring Data usage in a variety of contexts. Currently most of the integration is targeted towards Spring MVC.
743
743
744
+
[[core.extensions.querydsl]]
745
+
=== Querydsl Extension
746
+
747
+
http://www.querydsl.com/[Querydsl] is a framework which enables the construction of statically typed SQL-like queries via its fluent API.
748
+
749
+
Several Spring Data modules offer integration with Querydsl via `QueryDslPredicateExecutor`.
750
+
751
+
.QueryDslPredicateExecutor interface
752
+
====
753
+
[source, java]
754
+
----
755
+
public interface QueryDslPredicateExecutor<T> {
756
+
757
+
T findOne(Predicate predicate); <1>
758
+
759
+
Iterable<T> findAll(Predicate predicate); <2>
760
+
761
+
long count(Predicate predicate); <3>
762
+
763
+
boolean exists(Predicate predicate); <4>
764
+
765
+
// … more functionality omitted.
766
+
}
767
+
----
768
+
<1> Finds and returns a single entity matching the `Predicate`.
769
+
<2> Finds and returns all entities matching the `Predicate`.
770
+
<3> Returns the number of entities matching the `Predicate`.
771
+
<4> Returns if an entity that matches the `Predicate` exists.
772
+
====
773
+
774
+
To make use of Querydsl support simply extend `QueryDslPredicateExecutor` on your repository interface.
@@ -908,7 +960,7 @@ Assume we have 30 Person instances in the database. You can now trigger a reques
908
960
You see that the assembler produced the correct URI and also picks up the default configuration present to resolve the parameters into a `Pageable` for an upcoming request. This means, if you change that configuration, the links will automatically adhere to the change. By default the assembler points to the controller method it was invoked in but that can be customized by handing in a custom `Link` to be used as base to build the pagination links to overloads of the `PagedResourcesAssembler.toResource(…)` method.
909
961
910
962
[[core.web.type-safe]]
911
-
==== QueryDSL web support
963
+
==== Querydsl web support
912
964
913
965
For those stores having http://www.querydsl.com/[QueryDSL] integration it is possible to derive queries from the attributes contained in a `Request` query string.
0 commit comments