@@ -20,9 +20,9 @@ A `SelectionSpecification` allows to iteratively build a query from a "base", ad
20
20
====
21
21
[source, java, indent=0]
22
22
----
23
- SelectionSpecification<Book> spec = session.createSelectionSpecification (
24
- "from Book" ,
25
- Book.class
23
+ SelectionSpecification<Book> spec = SelectionSpecification.create (
24
+ Book.class ,
25
+ "from Book"
26
26
);
27
27
----
28
28
====
@@ -33,7 +33,7 @@ or a root entity as the base -
33
33
====
34
34
[source, java, indent=0]
35
35
----
36
- SelectionSpecification<Book> spec = session.createSelectionSpecification (Book.class);
36
+ SelectionSpecification<Book> spec = SelectionSpecification.create (Book.class);
37
37
----
38
38
====
39
39
@@ -45,15 +45,15 @@ Once we have the `SelectionSpecification` we can adjust the query adding restric
45
45
----
46
46
// from here we can augment the base query "from Book",
47
47
// with either restrictions
48
- spec.restriction (
48
+ spec.restrict (
49
49
Restriction.restrict(
50
50
Book_.suggestedCost,
51
51
Range.closed(10.00, 19.99)
52
52
)
53
53
);
54
54
55
55
// or here with some sorting
56
- spec.order (
56
+ spec.sort (
57
57
Order.asc(Book_.suggestedCost)
58
58
)
59
59
----
@@ -70,7 +70,7 @@ After adjusting the query, we can obtain the executable `SelectionQuery`:
70
70
====
71
71
[source, java, indent=0]
72
72
----
73
- SelectionQuery<Book> qry = ds.createQuery();
73
+ SelectionQuery<Book> qry = ds.createQuery(session );
74
74
List<Book> books = qry.getResultList();
75
75
----
76
76
====
@@ -81,17 +81,17 @@ These calls can even be chained, e.g.
81
81
====
82
82
[source, java, indent=0]
83
83
----
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 (
88
88
Restriction.restrict(
89
89
Book_.suggestedCost,
90
90
Range.closed(10.00, 19.99)
91
91
)
92
- ).order (
92
+ ).sort (
93
93
Order.asc(Book_.suggestedCost)
94
- ).createQuery();
94
+ ).createQuery(session );
95
95
----
96
96
====
97
97
@@ -112,14 +112,14 @@ At the moment, only update and delete queries are supported. E.g.
112
112
====
113
113
[source, java, indent=0]
114
114
----
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 (
119
119
Restriction.restrict(
120
120
Book_.suggestedCost,
121
121
Range.closed(10.00, 19.99)
122
122
)
123
- ).createQuery();
123
+ ).createQuery(session );
124
124
----
125
125
====
0 commit comments