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