How long is the period between these two calls?
Believe me, you really don't need 1000000 of records in one single call. Try to split your search result! That number is really orrible for a database.
No help for this, just recode.
I am having the same problem. I have an entity that contains only 976 records. With commit option A and read-ahead set to either on-load or on-find, the findAll() call basically gets all the data from the database the first time around (which is fine). However, when I tried to access the data the 2nd time, it took over 40 secs to return the data from the cache. I tested this using JBoss 3.0.0 final and JBoss 3.0.1 rc1. JBoss 3.0.0 final was even taking longer, often over 90 seconds for the data to come back from the cache.
P.S. The time between the two calls was very short (like a couple of seconds).
Any insights on this will be greatly appreciated,