How to convert nested SQL to HQL

前端 未结 4 1555
-上瘾入骨i
-上瘾入骨i 2021-01-02 01:52

I am new to the Hibernate and HQL. I want to write an update query in HQL, whose SQL equivalent is as follows:

update patient set 
      `last_name` = \"new_         


        
4条回答
  •  独厮守ぢ
    2021-01-02 02:04

    String update = "update Patient p set p.last_name = :new_last, p.first_name = :new_first where p.id = some (select doctor.id from Doctor doctor where doctor.clinic_id = 22 and city = 'abc_city')";
    

    You can work out how to phrase hql queries if you check the specification. You can find a section about subqueries there.

提交回复
热议问题