Streams are no longer closed by terminal operations

This is no longer true, according to H6 migration guide, so undocument it
This commit is contained in:
Gavin King 2022-01-29 20:09:19 +01:00
parent 8025af7592
commit 6f3592ac25
1 changed files with 0 additions and 13 deletions

View File

@ -556,19 +556,6 @@ However, it's much better to close the `ResultSet` as soon as possible.
The program should always close a `Stream` either explicitly, by calling `close()`, or using a https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html[try-with-resources] block. The program should always close a `Stream` either explicitly, by calling `close()`, or using a https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html[try-with-resources] block.
==== ====
There's one exception to this rule: the `Stream` is automatically closed after a terminal operation, as illustrated by the following example:
[[jpql-api-stream-terminal-operation]]
====
[source, JAVA, indent=0]
----
include::{sourcedir}/HQLTest.java[tags=jpql-api-stream-terminal-operation]
----
====
Here, the `Stream` is closed automatically after the `collect()` method is called.
[[hql-query-plan-cache]] [[hql-query-plan-cache]]
=== Entity query plan cache === Entity query plan cache