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: documentation/src/main/asciidoc/userguide/appendices/Legacy_Criteria.adoc
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ For details on the JPA APIs, see <<chapters/query-criteria/Criteria.adoc#criteri
12
12
13
13
Hibernate features an intuitive, extensible criteria query API.
14
14
15
-
[[querycriteria-creating]]
15
+
[[criteria-creating]]
16
16
=== Creating a `Criteria` instance
17
17
18
18
The interface `org.hibernate.Criteria` represents a query against a particular persistent class.
@@ -25,7 +25,7 @@ crit.setMaxResults(50);
25
25
List cats = crit.list();
26
26
----
27
27
28
-
[[querycriteria-narrowing]]
28
+
[[criteria-narrowing]]
29
29
=== Narrowing the result set
30
30
31
31
An individual query criterion is an instance of the interface `org.hibernate.criterion.Criterion`.
@@ -95,7 +95,7 @@ List cats = sess.createCriteria(Cat.class)
95
95
.list();
96
96
----
97
97
98
-
[[querycriteria-ordering]]
98
+
[[criteria-ordering]]
99
99
=== Ordering the results
100
100
101
101
You can order the results using `org.hibernate.criterion.Order`.
@@ -120,7 +120,7 @@ List cats = sess.createCriteria(Cat.class)
120
120
.list();
121
121
----
122
122
123
-
[[querycriteria-associations]]
123
+
[[criteria-associations]]
124
124
=== Associations
125
125
126
126
By navigating associations using `createCriteria()` you can specify constraints upon related entities:
@@ -187,7 +187,7 @@ A second query would need to retrieve the cats with mates who's name started wit
187
187
188
188
Thirdly, in memory; the lists would need to be joined manually.
189
189
190
-
[[querycriteria-dynamicfetching]]
190
+
[[criteria-dynamicfetching]]
191
191
=== Dynamic association fetching
192
192
193
193
You can specify association fetching semantics at runtime using `setFetchMode()`.
@@ -203,7 +203,7 @@ List cats = sess.createCriteria(Cat.class)
203
203
204
204
This query will fetch both `mate` and `kittens` by outer join.
205
205
206
-
[[querycriteria-components]]
206
+
[[criteria-components]]
207
207
=== Components
208
208
209
209
To add a restriction against a property of an embedded component, the component property name should be prepended to the property name when creating the `Restriction`.
@@ -217,15 +217,15 @@ List cats = session.createCriteria(Cat.class)
217
217
.list();
218
218
----
219
219
220
-
Note: this does not apply when querying collections of components, for that see below <<querycriteria-collections>>
220
+
Note: this does not apply when querying collections of components, for that see below <<criteria-collections>>
221
221
222
-
[[querycriteria-collections]]
222
+
[[criteria-collections]]
223
223
=== Collections
224
224
225
225
When using criteria against collections, there are two distinct cases.
226
226
One is if the collection contains entities (eg. `<one-to-many/>` or `<many-to-many/>`) or components (`<composite-element/>` ),
227
227
and the second is if the collection contains scalar values (`<element/>`).
228
-
In the first case, the syntax is as given above in the section <<querycriteria-associations>> where we restrict the `kittens` collection.
228
+
In the first case, the syntax is as given above in the section <<criteria-associations>> where we restrict the `kittens` collection.
229
229
Essentially we create a `Criteria` object against the collection property and restrict the entity or component properties using that instance.
230
230
231
231
For querying a collection of basic values, we still create the `Criteria` object against the collection,
@@ -240,7 +240,7 @@ List cats = session.createCriteria(Cat.class)
240
240
.list();
241
241
----
242
242
243
-
[[querycriteria-examples]]
243
+
[[criteria-examples]]
244
244
=== Example queries
245
245
246
246
The class `org.hibernate.criterion.Example` allows you to construct a query criterion from a given instance.
@@ -283,7 +283,7 @@ List results = session.createCriteria(Cat.class)
283
283
.list();
284
284
----
285
285
286
-
[[querycriteria-projection]]
286
+
[[criteria-projection]]
287
287
=== Projections, aggregation and grouping
288
288
289
289
The class `org.hibernate.criterion.Projections` is a factory for `Projection` instances.
@@ -385,7 +385,7 @@ List results = session.createCriteria(Cat.class)
385
385
.list();
386
386
----
387
387
388
-
[[querycriteria-detachedqueries]]
388
+
[[criteria-detachedqueries]]
389
389
=== Detached queries and subqueries
390
390
391
391
The `DetachedCriteria` class allows you to create a query outside the scope of a session and then execute it using an arbitrary `Session`.
0 commit comments