-->
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: Hibernate and Oracle Hints
PostPosted: Thu Feb 12, 2004 2:58 pm 
Newbie

Joined: Thu Feb 12, 2004 2:48 pm
Posts: 1
How does one use Oracle hints with Hibernate? For example:

SELECT /*+ use_nl (ct ec du) */ ct.CNTCT_TYPE_CD, ct.CNTCT_ID, ct.LOC_CD, ct.PARTY_ID, ct.PROF_TYPE_CD, ct.DEV_SEQ_ID, ec.CNTCT_ID, ec.EMAIL_ADR
FROM DEV_USER du, EMAIL_CNTCT ec, CNTCT ct
WHERE ct.DEV_SEQ_ID = du.DEV_SEQ_ID)
AND du.AD_DOMAIN_USER_ID IN ('usr1', 'usr2', 'usr3', 'usr4', 'usr5', 'usr6', 'usr7')
AND ct.CNTCT_ID = ec.CNTCT_ID AND ct.CNTCT_TYPE_CD IN ('E');


The /*+ use_nl (ct ec du) */ needs to be added to tell Oracle to use nested loops.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2004 2:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You could probably try session.createSQLQuery()


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2004 3:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
If someone can give me a list of what query hints generally look like in all the major databases, I am not adverse to adding something like:

Query.setHint(String)

or something.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2004 4:09 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 3:09 pm
Posts: 58
Well, SQL Server 2000 (not sure about earlier versions) uses the OPTION clause at the end of the query:

Code:
SELECT * FROM mytable OPTION (hint1, hint2, ...hintN)


But it also has table hints and join hints using a different syntax. Not sure if other databases do something similar...


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.