-->
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: HQL versus Criteria queries
PostPosted: Fri Mar 03, 2006 3:35 am 
Newbie

Joined: Mon Jan 16, 2006 1:25 am
Posts: 2
Hibernate version: 3.1

In the document it's given that

11.4.3. Criteria queries
HQL is extremely powerful but some developers prefer to build queries dynamically, using an object-oriented
API, rather than building query strings.

Can anybody compare these two approaches for retrieving data?
Is there any overhead for using Criteria for simple
queries instead of HQL?

Please advise as currently we are handling a large project and we have urgently take a policy decision which will have long term effect.

Thanks in advance.
Girish Varde


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 5:56 am 
Beginner
Beginner

Joined: Wed Aug 04, 2004 4:33 am
Posts: 45
Location: Switzerland
No there is no overhead. One thing is maybe that hql is more readable then if you have your queries defined with criteria.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 11:33 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
Criteria queries should only be used for building queries dynamicallly, or if you need the projection stuff it does because that's pretty cool

otherwise HQL is better

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.