-->
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: how to do recursive and subquery using hiberate
PostPosted: Wed Nov 26, 2003 2:56 pm 
Newbie

Joined: Mon Oct 06, 2003 2:20 pm
Posts: 10
Hi,

I have a user table, contains
userid, managerid

I have a resursive query written plsql

SELECT USR.USER_ID, USR.MANAGER_ID
FROM FBB_USER USR
WHERE USR.USER_ID NOT IN
( SELECT NVL(ALT.MANAGER_ID,0)

FROM FBB_USER ALT )
START WITH USR.USER_ID = '1'
CONNECT BY PRIOR USR.USER_ID = USR.MANAGER_ID ;

how can I translate this to HQL?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 3:02 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You can't. A hierarchical query like this requires either:

- procedural code, which SQL doesn't provide

or

- proprietary vendor extensions like CONNECT BY or SELECT RECURSIVE

which internally, are executed as a procedure with recursive semantics. You either have to write and call a stored procedure and call it with Hibernate 2.1 createSQLQuery() or fall use the proprietary vendor function in direct SQL, again with a createSQLQuery() or with a fallback to a SQL connection.

P.S. We are working on a solution for this problem, but it won't be ready soon.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 3:56 pm 
Regular
Regular

Joined: Fri Aug 29, 2003 12:48 pm
Posts: 63
Is there any word on this? Can you perhaps outline the gist of the proposed solution?


Top
 Profile  
 
 Post subject: I'd also like to know the progress made on this issue.
PostPosted: Mon Apr 18, 2005 12:16 pm 
Regular
Regular

Joined: Thu Sep 09, 2004 6:46 pm
Posts: 96
I'd also like to know the progress made on this issue. Is there a JIRA listing?


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.