-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria too slow, how can I get HQL from a Criteria?
PostPosted: Tue May 30, 2006 1:45 pm 
Newbie

Joined: Tue May 30, 2006 1:33 pm
Posts: 5
Hibernate version:
3.1.2

Hi, I´m having performance problems in the application, after using a profiler, I find out that it always has to do with CriteriaQuery.list (also when getting a property of a mapped class).
Googling I found that Criteria is less performant than HQL, but I have widely spread Criterias in the system, and the queries are not simple. Thats why I need something to get HQL from a Criteria.

If someone thinks my problem can be anything else? I´ll be thankfull to hear about it.

Thanks.
Mamana from Argentina


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 6:52 pm 
Regular
Regular

Joined: Mon May 22, 2006 2:30 pm
Posts: 74
The list() method is what causes the query to execute, so it is naturally going to be the slowest part, since that is when the database is being hit. The Criteria really should not be any slower than using HQL, unless for some reason it generates inefficient SQL in a complex scenario. You can turn on Hibernate logging to see what the actual generated SQL looks like.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 9:11 pm 
Newbie

Joined: Tue May 30, 2006 1:33 pm
Posts: 5
thanks for you help, but the DB doesnt seem to be the problem, since the mapping was forced fetch everything (no lazy relations). Actualy the profiler shows that there a being less than 1k DB hits against 85 millon calls to CriteriaQuery.list

Thanks anyway

mamana.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.