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.  [ 5 posts ] 
Author Message
 Post subject: Which Is Better
PostPosted: Mon Sep 22, 2008 1:52 am 
Newbie

Joined: Sat Apr 26, 2008 12:16 pm
Posts: 5
Hi Guys ,


Is It Better To Use HIberante Query or HIbernate Criteria .

what about the performancs


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 3:01 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
If there was a clean and easy answer to this question only the 'winner' would be part of hibernate.

It depends on what you try to do. Criteria is nice for dynamically creating queries, e.g. for search screens. If you want a full replacement for sql HQL is the better option.

Unless you are creating tenthousands of small fast sql statement the performance should be irrelevant. They both create and execute sql and the transfer of data through the wire and out of the database typically is order of magnitude slower then creation of the sql-statement.

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 6:32 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
Yes, As schauder said, Criteria is just to form the HQL query string dynamically based on the user inputs.


Top
 Profile  
 
 Post subject: Criteria or Query
PostPosted: Mon Sep 22, 2008 9:51 am 
Newbie

Joined: Sat Apr 26, 2008 12:16 pm
Posts: 5
Iam Currently working on gwt and hibernate.
some of our guys have written the their database code completely using criteria and some by queries.but the application goes slow for the guys who used queries and it is fast for guys who used criteria.this means using criteria is faster than queries.

right


Top
 Profile  
 
 Post subject: Re: Criteria or Query
PostPosted: Mon Sep 22, 2008 2:13 pm 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
jagadesh wrote:
Iam Currently working on gwt and hibernate.
some of our guys have written the their database code completely using criteria and some by queries.but the application goes slow for the guys who used queries and it is fast for guys who used criteria.this means using criteria is faster than queries.

right


ROFL

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


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