-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Why does hibernate flush on a readonly query ?
PostPosted: Wed Apr 28, 2010 12:35 am 
Newbie

Joined: Tue Apr 27, 2010 2:59 pm
Posts: 2
Version: 3.2.6 Ga

I am using auto flush in my application to flush my session. According to the documentation, hibernate flushes the session before a query to make sure that no stale data is returned which is good. However, when i look at the performance of my application, out of 30 seconds of activity, 28 seconds is spent trying to retreive data from the database. Checked with the DBA's to find out if the query is taking long time but the query took like 1.3seconds .

Query executed:
Query = "select detail from Details where batchId=?"
query.list();

Within the whole execution(30 seconds),
no.of times the query was executed : 107
no.of records fetched as part of all the execution is around 6000

The query is set to readOnly as true. I am not sure why the data fetched using readOnly is being checked if there are any updates so that it can be flushed?

I am expecting that the flush should not happen for a read only query(even if it does happen, why is the performance being effected at this extent?).

Am i missing something here?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.