Skip to content

Commit b1c69a2

Browse files
committed
update docs with all field types for HQL extract()
Signed-off-by: Gavin King <[email protected]>
1 parent d0ed4d0 commit b1c69a2

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

documentation/src/main/asciidoc/querylanguage/Expressions.adoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,34 @@ The special function `extract()` obtains a single field of a date, time, or date
687687
- Its first argument is an expression that evaluates to a date, time, or datetime.
688688
- Its second argument is a date/time _field type_.
689689

690-
Field types include: `day`, `month`, `year`, `second`, `minute`, `hour`, `day of week`, `day of month`, `week of year`, `date`, `time`, `epoch` and more.
690+
Field types include:
691+
692+
[cols="~,^15,^10,~"]
693+
|===
694+
| Field | Type | Range | Notes
695+
696+
| `day` | `Integer` | 1-31 | Calendar day of month
697+
| `month` | `Integer` | 1-12 |
698+
| `year` | `Integer` | |
699+
| `week` | `Integer` | 1-53 | ISO-8601 week number (different to `week of year`)
700+
| `quarter` | `Integer` | 1-4 | Quarter defined as 3 months
701+
| `hour` | `Integer` | 0-23 | Standard 24-hour time
702+
| `minute` | `Integer` | 0-59 |
703+
| `second` | `Float` | 0-59 | Includes fractional seconds
704+
| `nanosecond` | `Long` | | Granularity varies by database
705+
| `day of week` | `Integer` | 1-7 |
706+
| `day of month` | `Integer` | 1-31 | Synonym for `day`
707+
| `day of year` | `Integer` | 1-365 |
708+
| `week of month` | `Integer` | 1-5 |
709+
| `week of year` | `Integer` | 1-53 |
710+
| `epoch` | `Long` | | Elapsed seconds since January 1, 1970
711+
| `date` | `LocalDate` | | Date part of a datetime
712+
| `time` | `LocalTime` | | Time part of a datetime
713+
| `offset` | `ZoneOffset` | | Timezone offset
714+
| `offset hour` | `Integer` | | Hours of offset
715+
| `offset minute` | `Integer` | 0-59 | Minutes of offset
716+
|===
717+
691718
For a full list of field types, see the Javadoc for https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/query/TemporalUnit.html[`TemporalUnit`].
692719

693720
[source, hql]

documentation/src/main/asciidoc/querylanguage/Relational.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ HQL defines two additional aggregate functions which accept a logical predicate
237237
|===
238238
| Aggregate function | Argument type | Result type | JPA standard
239239

240-
| `any()` | Logical predicate | `Boolean` | ✖
241-
| `every()` | Logical predicate | `Boolean` | ✖
240+
| `any()` or `some()` | Logical predicate | `Boolean` | ✖
241+
| `every()` or `all()` | Logical predicate | `Boolean` | ✖
242242
|===
243243

244244
We may write, for example, `every(p.amount < 1000.0)`.

documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,8 +2524,8 @@ HQL defines the two additional aggregate functions which accept a logical predic
25242524
|===
25252525
| Aggregate function | Argument type | Result type | JPA standard
25262526
2527-
| `any()` | Logical predicate | `Boolean` | &cross;
2528-
| `every()` | Logical predicate | `Boolean` | &cross;
2527+
| `any()` or `some()` | Logical predicate | `Boolean` | &cross;
2528+
| `every()` or `all()` | Logical predicate | `Boolean` | &cross;
25292529
|===
25302530
25312531
NOTE: Aggregate functions usually appear in the `select` clause, but control over aggregation is the responsibility of the `group by` clause, as described <<hql-group-by,below>>.

0 commit comments

Comments
 (0)