Skip to content

Commit 83fca9f

Browse files
committed
HHH-19364 update docs to reflect latest API
1 parent b1d5b5e commit 83fca9f

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

documentation/src/main/asciidoc/userguide/chapters/query/programmatic/QuerySpecification.adoc

+18-18
Original file line numberDiff line numberDiff line change
@@ -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);
7474
List<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
====

whats-new.adoc

+11-11
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ A new API has been added for incremental definition of a query, with support for
129129
====
130130
[source, java, indent=0]
131131
----
132-
SelectionQuery<Book> qry = session.createSelectionSpecification(
133-
"from Book",
134-
Book.class
135-
).restriction(
132+
SelectionQuery<Book> qry = SelectionSpecification.create(
133+
Book.class,
134+
"from Book"
135+
).restrict(
136136
Restriction.restrict(
137137
Book_.suggestedCost,
138138
Range.closed(10.00, 19.99)
139139
)
140-
).order(
140+
).sort(
141141
Order.asc(Book_.suggestedCost)
142-
).createQuery();
142+
).createQuery(session);
143143
----
144144
====
145145

@@ -148,15 +148,15 @@ as well as mutations -
148148
====
149149
[source, java, indent=0]
150150
----
151-
MutationQuery<Book> qry = session.createMutationSpecification(
152-
"delete Book",
153-
Book.class
154-
).restriction(
151+
MutationQuery<Book> qry = MutationSpecification.create(
152+
Book.class,
153+
"delete Book"
154+
).restrict(
155155
Restriction.restrict(
156156
Book_.suggestedCost,
157157
Range.closed(10.00, 19.99)
158158
)
159-
).createQuery();
159+
).createQuery(session);
160160
----
161161
====
162162

0 commit comments

Comments
 (0)