Question : converting an sql join query into hibernate named query

I have Three tables.
Equipment , Cost, City
Data is retrived from these three tables  using the following  SQL Query

Select e.modelName, c.Name from Eqipment e,City c, Cost co where e.column2=co.column1 and co.column2=c.column3
and c.name='London'

I have written Equipment , Cost and City Entity Classes .

I am  facing  problem  in writting an Hibernate Named Query for the above SQL Query.Please Guide me.

Thanks in advance for the Help.



 

Answer : converting an sql join query into hibernate named query

try this
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var q = (from e in Equipment
                     join co in Cost
                     on e.column2 equals co.column1 
                     join c in City
                     on co.column2 equals c.column3  
                     where c.name == "London"
                     select new {
                         e.modelname,
                         c.name
                     }).ToList();
Random Solutions  
 
programming4us programming4us