[hibernate-dev] Query#iterate

Steve Ebersole steve at hibernate.org
Fri Jan 27 13:01:16 EST 2017


On Fri, Jan 27, 2017 at 9:51 AM Christian Beikov <christian.beikov at gmail.com>
wrote:

> I just know of people that are using iterate() now for efficient
> incremental processing, but I guess any other approach(streams maybe?)
> to do incremental processing would be good enough for these users.
>
>
ScrollableResults do not meet that need?



> Unfortunately I don't know what a shallow query is or what the
> implication on the query or the processing of being shallow are.
>

Just what I said before.  "shallow" is simply a boolean flag that is part
of the translator.  It is set to true when the translation is triggered
from Query#iterate.  When the translation is triggered from Query#list or
Query#scroll it is set to false.



> I guess this has to do with how row processing is done?


The main thing is effects is the SQL we render.  For "entity returns" it
simply selects the ids and we expect to then load them (immediately!) by
that id (N+1).  Its usefulness is actually VERY limited in scope as it
actually performs horrendously in, what, 95-99% of use cases?

Interestingly it really does not have much effect on "row processing".


More information about the hibernate-dev mailing list