fix javax package name + minor code example errors

(spotted by @andrei-ivanov)
This commit is contained in:
Gavin 2023-05-29 12:41:23 +02:00 committed by Christian Beikov
parent d1b9424ec4
commit 8fbb62ade8
2 changed files with 5 additions and 5 deletions

View File

@ -601,7 +601,7 @@ for (var result : results) {
This is bearable, but let's explore some other options.
JPA lets us specify that we want each query result packaged as an instance of `javax.persistence.Tuple`.
JPA lets us specify that we want each query result packaged as an instance of `jakarta.persistence.Tuple`.
All we have to do is pass the class `Tuple` to `createQuery()`.
[source, java]
@ -630,8 +630,8 @@ var results =
Map.class)
.getResultList();
for (var map : results) {
String title = (String) tuple.get("title");
String preamble = (String) tuple.get("preamble");
String title = (String) map.get("title");
String preamble = (String) map.get("preamble");
}
----
[source, java]
@ -643,7 +643,7 @@ var results =
.getResultList();
for (var list : results) {
String title = (String) list.get(0);
String preamble = (String) tuple.get(1);
String preamble = (String) list.get(1);
}
----

View File

@ -1938,7 +1938,7 @@ There's no need to bother with trying to represent a "tuple of length 1".
But if there are multiple expressions in the select list then:
- by default, each query result is packaged as an array of type `Object[]`, or
- if explicitly requested by passing the class `Tuple` to `createQuery()`, the query result is packaged as an instance of `javax.persistence.Tuple`.
- if explicitly requested by passing the class `Tuple` to `createQuery()`, the query result is packaged as an instance of `jakarta.persistence.Tuple`.
[[hql-select-clause-projection-example]]
//.Query results as lists