-->
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: One-time translation of HQL queries
PostPosted: Wed Feb 11, 2009 4:23 am 
Newbie

Joined: Thu Jan 04, 2007 8:22 am
Posts: 12
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2.2.ga

Dear all,

Is it true that HQL named queries (externalized in XML files) are translated into SQL queries only once and then those translations are cached?

If this is true, does that give named HQL queries any performance advantage over querying using Criteria from this perspective?

Thanks in advance for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 11, 2009 4:48 am 
Newbie

Joined: Thu Jan 04, 2007 8:22 am
Posts: 12
I was going through the JavaDocs and in the documentation of the SessionFactoryImpl class, the following is mentioned:

Quote:
Concrete implementation of the SessionFactory interface. Has the following responsibilites

caches configuration settings (immutably)
caches "compiled" mappings ie. EntityPersisters and CollectionPersisters (immutable)
caches "compiled" queries (memory sensitive cache)
manages PreparedStatements
delegates JDBC Connection management to the ConnectionProvider
factory for instances of SessionImpl
This class must appear immutable to clients, even if it does all kinds of caching and pooling under the covers. It is crucial that the class is not only thread safe, but also highly concurrent. Synchronization must be used extremely sparingly.


I feel that the statement in bold could be the answer to my question, but is the improvement in performance because of this negligible or noticeable?


Top
 Profile  
 
 Post subject: Re-post
PostPosted: Thu Feb 12, 2009 6:28 am 
Newbie

Joined: Thu Jan 04, 2007 8:22 am
Posts: 12
Re-post


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.