-->
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: How to implement a sub query as a table alias using Criteria
PostPosted: Mon Nov 17, 2014 1:48 pm 
Newbie

Joined: Fri Oct 24, 2014 5:57 am
Posts: 2
Can I use hibernate Criteria objects to build a query with sub-selects as table alias, see example below, aliases b & c?

The current Criteria implementation uses a massive IN clause which is slow.
The DBA's have suggested this optimisation, but as far as I can see it cannot be done with hibernate Criteria objects..

select
*
FROM VW_ACCOUNTS acc,
(select distinct account_id, legal_entity_id from VW_AUTH where User_ID='user01' and party_id ='12345' ) b,
(select distinct VALUE from VW_AUTH2 where party_id='12345' and SRVC_ID='345' ) c
WHERE acc.status='LIVE'
AND acc.client_id =12345
AND (acc.account_id = b.account_id
OR acc.secondary_id = b.secondary_id)
AND acc.account_id = c.VALUE
ORDER BY lower(acc.account_id) ASC;


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.