i am a bit confused about the :
Query q = entityManager.createNativeQuery( sql ).setHint( QueryHints.HINT_FETCH_SIZE, "1000" );
what does QueryHints.HINT_FETCH_SIZE, "1000" exacly do does it start fetching rows with a size of 1000 untill its done so i would not run out of db memory or it will only give u 1000 rows?