-->
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.  [ 9 posts ] 
Author Message
 Post subject: Way to insert SQL comments into HQL generated SQL?
PostPosted: Thu Apr 15, 2004 1:15 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
Hey all,

I need to be able to insert the SQL comment /*+RULE*/ for stinking Oracle to figure out what indexes it should use. However, the SQL I need to insert it into is generated from a fairly complex HQL query.

Is there a way that anyone knows of via the Query object or whatever, to instruct the SQL generator to put a SQL comment in it's final result? So that it would look something like:

SELECT /*+RULE*/ name from user ....

Thanks for any advice.

Matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 1:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This will be a new feature in the next version, you can take a look at the CVS, there is Query.setComment()

Currently it is not possible I think.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 2:09 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
p6spy (http://www.p6spy.com/index.html) might be useful for this, at least until Hibernate supports SQL comments.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 4:09 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
Thanks for the replys.

Michael: I've checked latest CVS for the setComment() method and it doesn't seem to be there? That is basically exactly what I need though, and what I was going to write if I couldn't find an existing way.

Here's the version of the Query interface I'm checking: http://cvs.sourceforge.net/viewcvs.py/h ... &view=auto

Let me know if I'm in the wrong place.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 4:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it's in the v22branch...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 5:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Look here


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 6:01 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
Thanks, I see it now. Is there an estimated release time for v2.2? I checked the roadmap but it doesn't have any dates. I'm just wondering if it's worth it for me to port the setComment() changes back to the version of hibernate I'm using or wait for v2.2.

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 6:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It will be sometime before v3.0 is the recommended version.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 4:05 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
If anyone is interested (or found this thread via a search or something) I've written a patch against the older branches of hibernate that allows you to insert SQL comments that Oracle will use as optimizer hints. It's probably not appropriate to be included against the development version of Hibernate since v2.2 will support a version of this already.

I have a patch file against v2.03 ready and am working on one versus v2.1. I think they are too big to include in the forum so send me a message if you're interested.

Matt


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