-->
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: Table Aliases
PostPosted: Thu Dec 02, 2004 9:09 pm 
Newbie

Joined: Wed Sep 17, 2003 9:02 pm
Posts: 13
Hibernate version:2.1.6

Hi All.

For example for the name query:

select client from
package.Client as client
where client.id = :clientID

the SQL that is generated contains alias like client1_.field name.

Is there a way, we can specify the alias that has to be generated in the SQL.

Thank you for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 3:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no.

May I ask why you need that ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 1:40 pm 
Newbie

Joined: Wed Sep 17, 2003 9:02 pm
Posts: 13
The query generated is doing a full table scan. After discussing with our DBA's, we came to the conclusion only way to make it use the index is to use Oracle hints. The hint we have to use id /* use_nl (alias name) */.

Since the alias is generated by Hibernate, I am not sure what to give in the "alias name". So, if I can instruct Hibernate to use the alias I mention, I thought I can use it in the hint.

Please let me know in case you need additional clarification. Thank you for your help to solve my problem.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 2:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is not possible in HQL.

May i suggest that you try to use createSQLQuery which allows you to do this stuff in a native way.
(just remember that createSQLQuery for the moment only support returning entities - not scalar values)

_________________
Max
Don't forget to rate


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.