I am using Hibernate 4.1.6 and having issues with the speed that a list is built. I am running the following query.
public void doQuery(final Baz baz){
fi
We ran into a similar issue, dunno if it's related. Basically, since we were newing up new SessionFactorys once per query, it was doing queries like:
select streamref0_.UUID as UUID145_, streamref0_.Tape_TapeId as Tape2_145_ from StreamRefToTape streamref0_ where streamref0_.UUID=?
You'll notice the large numbers in there. Turns out that it increments once per new session factory. Anyway, this was causing oracle to spend all its time doing a new plan for each query (it reported cpu was almost all in "hard parse" time generating new plans--I guess Oracle is slow to generate plans that it hasn't seen before?). The fix in this particular case was to just use the same factory instead of a new one each time. See also Hibernate produce different SQL for every query
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2588723819082 explains hard parses, which are apparently bad.
Another possible fix is to use "raw sql" (jdbc) or possibly raw sql queries within hibernate, though that didn't seem to fix the problem in this particular case somehow...