Similar to the issue #29886
The org.springframework.orm.jpa.SharedEntityManagerCreator.queryTerminatingMethods does not contain the "scroll" method:
Would it be possible to add scroll?
Comment From: sbrannen
Hi @soosue,
Congratulations on reporting your first issue for Spring Framework! 👍
Would it be possible to add
scroll?
Yes. We'll add that support in 6.1.x and backport it to 6.0.x and 5.3.x.
Comment From: jhoeller
Since the detection of scroll is primarily there for preventing accidental Connection leaks (like our existing detection of stream), with the scroll operation not actually working properly outside of a transaction, this should be rather marked as a bug. Query termination is a defensive measure that immediately closes the underlying EntityManager/Connection outside of a transaction.
Only the immediate result operations actually work outside of a transaction, whereas stream or scroll seem to iterate fine at first but eventually leak the Connection, when they really need to operate within a transaction boundary. Only ever use stream and scroll within a transaction (which may be marked as read-only but needs to be managed).
In any case, this closes the gap with our 5.3-intended detection of Hibernate query termination methods, with all such methods treated consistently now.