The EJB container gets either a greedy or
lazy version of the enumerator when the finder runs.
For a lazy enumeration, only the first 25 items are retrieved, and if
things go normally and you need an item from the next set of 25 (and every
subsequent set up to the maximum number of items returned), the
hasMoreElements() method triggers a set of calls that gets the next set of
25. However, if the calling transaction ends before the end of the first
set of 25, or before any following set of 25 is retrieved, the remainder
is not available to you.
For a greedy enumerator, there is a construct that gets all the items, and
does not limit the fetch size. If the transaction is created in the finder
method's scope (for example, during the bean method's preInvoke
processing), a greedy enumerator should be returned; otherwise, it is a
lazy enumerator.
If only 25 items are returned, it is because the lazy enumerator is
returned.
|