-->
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: fetch in a subquery being used as part of an IN WHERE clause
PostPosted: Mon Feb 12, 2007 6:05 pm 
Newbie

Joined: Sat Jan 06, 2007 4:49 pm
Posts: 5
Hi there I am trying to formulate a HQL query to match this SQL


Code:
SELECT COUNT(*)
FROM  Db d
INNER JOIN [Server] s ON d.server_id = s.server_id
INNER JOIN ServerGroup_Server sgs ON s.server_id = sgs.server_id
INNER JOIN ServerGroup sg ON sgs.servergroup_id = sg.servergroup_id
WHERE sg.servergroup_id = 1


i have a HQL query to pull back all the servers

Code:
from ServerGroup as sg inner join fetch sg.Servers as s where sg.Identity = 1


but i dont understand how then to join the database class as i cant just do another inner join as server has no association to database, only database to server

ive tried doing

Code:
from Database d inner join d.Server s where s in (from ServerGroup as sg inner join fetch sg.Servers as s where sg.Identity = 1)


but get the error "fetch may not be used with scroll() or iterate()" which is fair enough s it states that in the documentation.

can someone please help me round this, i know its simple if you know how!

Thanx


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.