-->
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.  [ 1 post ] 
Author Message
 Post subject: Forcing the join (alias) order using criteria query
PostPosted: Mon Dec 17, 2012 5:53 pm 
Newbie

Joined: Mon Dec 17, 2012 5:44 pm
Posts: 1
I have a well normalized database and a query that needs to do several joins as well as a filter on one of the joined tables. My efforts to optimize the query on the database side (postgresql) have shown that I can get a dramatic (2 orders of magnitude) increase in speed if I change the order of my join statements.

The problem I have is that I'm using Hibernate Criteria to build the query and I don't know how to guarantee the order of the resulting joins when I use createAlias. For example:

Code:
criteria.createAlias("examTime","et");
criteria.createAlias("patient","pat");
criteria.createAlias("metadata","m");
criteria.createAlias("procedure","pro");


This creates an arbitrary (I honestly can't figure out what's deciding within hibernate) order to the joins.

How do I force the order of the joins in the emitted SQL? Using HQL is not an option for me.

Thanks,
-Max


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.