-->
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: Criteria vs HQL - general question
PostPosted: Tue Jul 25, 2006 7:59 am 
Newbie

Joined: Mon Jun 05, 2006 9:22 am
Posts: 3
As everyone, I am having a lot of simple queries for finding entities by different parameters. I want to create a dynamic way to replace all that finders, by providing entity instance (or some find-oriented subclass) to create dynamic query. I have 2 solutions:

1) using dynamic hql, which doesn't necessary be heavy for maintaince etc - remember that I am talking about all those simple queries without any explicit joins etc.

2) using criteria.

I do not have experience enough to tell which one solution is better. Things I do not like in criteria is that it tights me to the hibernate more than I like and that it, teoretically, breaks dao pattern, and that I can not easily see inner hql. btw, does criteria api creates hql before execution?


10x in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 12:20 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
Hi, the Criteria API and the HQL are both hibernates own implementation for queries. The cannot be used outside of hibernate.

For you're question, I personally like Criteria more for building dynamic queries while I prefer HQL for static (and more complex) queries. But that is about my personal likes and dislikes.

If you want to be independent from hibernate maybe thing about EJB3.0 and that EJB QL.


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.