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.  [ 4 posts ] 
Author Message
 Post subject: Queries and Performance
PostPosted: Mon Feb 25, 2008 1:02 pm 
Beginner
Beginner

Joined: Tue Jan 22, 2008 11:33 am
Posts: 46
Hi,

I was just reading through the documentation and found different ways to retrieve data from the database. If I want to get data
- from different tables
- defining a set of search criteria
- which way is the best or let's say the most performant one to go:
HQL, Criteria Query, Stored Procedures, retrieve everything and doing the work in the code (FOREACHs), ...

Is there a best practice?

Could anybody help me to go the right way???

Thanks for your help

antoschka


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 27, 2008 1:04 am 
Beginner
Beginner

Joined: Fri Jan 12, 2007 1:08 am
Posts: 41
I favor ICriteria because it is more type safe than HQL and it makes managing variable search criteria easier because you tell NHibernate what you want to do and it handles the implementation details. To me SPs are an unnecessary and less testable layer. And doing everything in code seems to miss the point of relational databases.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 27, 2008 4:17 am 
Beginner
Beginner

Joined: Tue Jan 22, 2008 11:33 am
Posts: 46
Thanks - that was the information I was looking for.

One Last Question:
Do I have the same possibilities to tweak performance through caching as I would have with other Query Technologies such as HQL?

Thanks in advance

antoschka


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 27, 2008 10:39 am 
Beginner
Beginner

Joined: Fri Jan 12, 2007 1:08 am
Posts: 41
Yes, both IQuery (HQL) and ICriteria leverage both levels of NHibernate's cache.


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