-->
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: how to cache EJB3 query already compiled - even at runtime?
PostPosted: Fri Jul 21, 2006 6:10 am 
Newbie

Joined: Wed May 31, 2006 6:40 am
Posts: 19
Hibernate version:
Ejb3 backed up by hibernate boundled with jboss 4.0.4 GA i think it's 3.20 cr2

I'd like the Fetch Group feature in JDO.... i'm using Ejb3 and i'd like to have a way to build a fetch group... i mean fetch an object and all the relative associations...

it's possible using joins & fetch like i read in
http://www.hibernate.org/hib_docs/entit ... ryhql.html
at 7.3

what's the best way to store an already COMPILED version of these query?
i read that @NamedQueries are read compiled and cached at start time...
but:
- i generete by ant my pojo... at this time i don't find any way to specify custom named query
- i'd like to have more versatility.. i mean i'd like to throw away stored procedures so i'd like change/add query at runtime... i'd like to have an "admin panel" where i can see and edit my queries...

is it possible to avoid re-compile every time my query?

thanks all


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 24, 2006 5:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
For 1 use an orm.xml file
For 2 this is not possible you'll have the compile time overhead. But this is not bad since Hibernate cache (HQL) query plans.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 4:51 am 
Newbie

Joined: Wed May 31, 2006 6:40 am
Posts: 19
emmanuel wrote:
For 1 use an orm.xml file
For 2 this is not possible you'll have the compile time overhead. But this is not bad since Hibernate cache (HQL) query plans.


For orm.xml file... where i can find some documentation and/or example?
In particular... is it possible to re-load orm file settings without restart applications? i think the ability to change (tweak) query without restart will be very useful!!!

[OT] is it possible to obtain by hibernate tools???

did You mean that Hibernate cache check if there's a compiled query given by the same string - ejb quey? that's cool!!!

but... if it so... what's the utility of named query???
after the first run.. everey query is cached!!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 1:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
named queries are still useful because they are tested at startup time, and I find it much cleaner in my code to have named queries

As for the doc, the orm.xml documentation, did you look at the reference documentation ;-)
http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#xml-overriding

_________________
Emmanuel


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.