-->
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: Create a new Criteria instance with two given aliases
PostPosted: Mon Nov 26, 2007 11:54 am 
Newbie

Joined: Mon Nov 26, 2007 11:41 am
Posts: 6
Hello everyone,
I wanted to ask a simple thing. I have a query like this:

SELECT node.name
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND parent.name = 'ELECTRONICS'
ORDER BY node.lft;

As you can see two aliases are created for the same table, how can I do this with hibernate criteria?

thanks in advance
Mario


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 27, 2007 6:14 am 
Beginner
Beginner

Joined: Thu May 17, 2007 9:56 am
Posts: 21
Location: India
You may need a new relationship entry with the same table in the mapping xml to create a same alise two times

_________________
Kuzhali


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 5:47 am 
Newbie

Joined: Mon Nov 26, 2007 11:41 am
Posts: 6
I don't like this approach, I prefer to use HQL.

With a new relationship entry with the same table in the mapping xml, the query is not built like the one I proposed.

Thank you for your response

Mario


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 8:18 am 
Beginner
Beginner

Joined: Wed May 16, 2007 7:12 am
Posts: 41
Location: London
did you try doing createAlias twice?

_________________
Dinesh Mahadevan

Visit me at http://www.yelani.com/


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.