@@ -20,9 +20,9 @@ A `SelectionSpecification` allows to iteratively build a query from a "base", ad
2020====
2121[source, java, indent=0]
2222----
23- SelectionSpecification<Book> spec = session.createSelectionSpecification (
24- "from Book" ,
25- Book.class
23+ SelectionSpecification<Book> spec = SelectionSpecification.create (
24+ Book.class ,
25+ "from Book"
2626);
2727----
2828====
@@ -33,7 +33,7 @@ or a root entity as the base -
3333====
3434[source, java, indent=0]
3535----
36- SelectionSpecification<Book> spec = session.createSelectionSpecification (Book.class);
36+ SelectionSpecification<Book> spec = SelectionSpecification.create (Book.class);
3737----
3838====
3939
@@ -45,15 +45,15 @@ Once we have the `SelectionSpecification` we can adjust the query adding restric
4545----
4646// from here we can augment the base query "from Book",
4747// with either restrictions
48- spec.restriction (
48+ spec.restrict (
4949 Restriction.restrict(
5050 Book_.suggestedCost,
5151 Range.closed(10.00, 19.99)
5252 )
5353);
5454
5555// or here with some sorting
56- spec.order (
56+ spec.sort (
5757 Order.asc(Book_.suggestedCost)
5858)
5959----
@@ -70,7 +70,7 @@ After adjusting the query, we can obtain the executable `SelectionQuery`:
7070====
7171[source, java, indent=0]
7272----
73- SelectionQuery<Book> qry = ds.createQuery();
73+ SelectionQuery<Book> qry = ds.createQuery(session );
7474List<Book> books = qry.getResultList();
7575----
7676====
@@ -81,17 +81,17 @@ These calls can even be chained, e.g.
8181====
8282[source, java, indent=0]
8383----
84- SelectionQuery<Book> qry = session.createSelectionSpecification (
85- "from Book" ,
86- Book.class
87- ).restriction (
84+ SelectionQuery<Book> qry = SelectionSpecification.create (
85+ Book.class ,
86+ "from Book"
87+ ).restrict (
8888 Restriction.restrict(
8989 Book_.suggestedCost,
9090 Range.closed(10.00, 19.99)
9191 )
92- ).order (
92+ ).sort (
9393 Order.asc(Book_.suggestedCost)
94- ).createQuery();
94+ ).createQuery(session );
9595----
9696====
9797
@@ -112,14 +112,14 @@ At the moment, only update and delete queries are supported. E.g.
112112====
113113[source, java, indent=0]
114114----
115- MutationQuery<Book> qry = session.createMutationSpecification (
116- "delete Book" ,
117- Book.class
118- ).restriction (
115+ MutationQuery<Book> qry = MutationSpecification.create (
116+ Book.class ,
117+ "delete Book"
118+ ).restrict (
119119 Restriction.restrict(
120120 Book_.suggestedCost,
121121 Range.closed(10.00, 19.99)
122122 )
123- ).createQuery();
123+ ).createQuery(session );
124124----
125125====
0 commit comments