Contrary to what you seem to think, the setFetchSize
does not limit the amount of records retrieved, it determines (or hints) how many records the driver should prefetch and cache. The exception is MySQL, which always prefetches all records, unless you set the fetch size to Integer.MIN_VALUE
.
The driver is simply retrieving so much rows that memory gets exhausted.