I am observing that in a single transaction while looking up distinct records the hibernate gets really slow. The reason is that because unique records are looked up and hibernate caches them and every new record that is looked up, the hibernates looks the item in the query, basically iterating through its cache list. This lookup time increases as hibernate cache builds up. I am talkign about ~ 1000 item look ups. My question is
1. Why does hibernate get slow with unique item lookup. What mechanism is it using to lookup the item in the cache? 2. While hibernate looks the item first in the cache before loading it from database, it DOES NOT call persistent objects hascode and equals method.Again how does it lookup item? 3. Is there any solution to to the slowness other than clearing the session cache every tome item is looked up?
I am not using level 2 cache.
Appreciate your responses/suggestions.
Wichka
|