views:

29

answers:

0

I'm wondering if is possible to convert this HQL query into a criteria api query.

select s1 
from Student
where 
     (
        select max(s2.Score)
        from Student
        where s1.Id = s2.Id
     )
      = 10

(selects the students that have their max score value equal to 10)

I don't know if I could use a detached criteria because of the 's1.Id = s2.Is' condition

Thanx for anyone who can help me