-->
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.  [ 2 posts ] 
Author Message
 Post subject: The first query takes so long and the nothing
PostPosted: Mon May 12, 2008 10:28 am 
Newbie

Joined: Mon May 12, 2008 9:58 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.3

Name and version of the database you are using: SQL Server

The generated SQL (show_sql=true):
SELECT f.*
FROM J INNER JOIN T ON t.jId = j.jId AND j.exjId = 'bbbbb''
INNER JOIN F f ON t.tenId=f.tenId
WHERE f.fin = 1 AND f.status!='X'
Takes 672 milis

SELECT f.fin, mr.sc
FROM M mr INNER JOIN FH fh ON mr.sFinHId=fh.finHId
INNER JOIN F f ON fh.finId=f.finId INNER JOIN Tt t ON f.tenId=t.tenId
INNER JOIN J j ON t.jId = j.jId AND j.exJId = 'aaaaaa'
WHERE mr.mfinid = 156
Takes 31 milis



I have problems whit a method that execute three queries in the worse case, but generally the amount of queries are two.
The problem is that the first query takes around of 650 milis and the others takes only 15 milis, and the queries are similars.
I have change the name of the Objects because i'm in a private corporation so don't answer syntax problems in the queries because there is no are.
The code to create the queries is this:


Query query = s.createSQLQuery(" First Query...")
F f = (F) query.uniqueResult(); //Takes 672 milis
if (f != null) {
query = s.createSQLQuery("Second Query...")
List<Object[]> values = query.list(); //Takes 31 milis
....
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 12, 2008 11:52 am 
Newbie

Joined: Mon May 12, 2008 9:58 am
Posts: 2
I forget to post that the method is in a web service and is executed N times. I duplicate the first query and see that the first query execution takes the same time (around 670 milis) but the duplication takes 0 milis.
I suppose that is because the caching of the query but I don't know why when the second call to the web service the query takes another 600 milis...
Please, help me..
Tks


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

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.