Hi..

I'd like to perform a join between two entities..

[Operator] has many [Client]

I can do this with this SQL sentence

select c.*, o.name from clients c join operators o on c.operator =
o.id

I would like to do this same query using HQL, for this I use this HQL
query

"from Client c join fetch c.Operator where c.Status = :status and
c.Cif in (:cifs)"

The HQL query results in

select (fields names goes here)
from   dbo.clients client0_ inner join dbo.operators operator1_ on
client0_.Operator = operator1_.Id
where  (client0_.Status = 1) and (client0_.Cif in (12345670 ,
12345678 ))

which is ok, but also execute a new query for every operator id that I
have (in my case I have 2 operators)

SELECT (fields names goes here)
FROM   dbo.clients clients0_
WHERE  clients0_.Operator = 2

SELECT (fields names goes here)
FROM   dbo.clients clients0_
WHERE  clients0_.Operator = 1

Which is not desirable... Why is this happening..? I just want to
execute the first query..

Hope you can help me..

Thanx
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to