gpt4 book ai didi

hibernate - 如何在名为query的grails中编写 “not exists”查询?

转载 作者:行者123 更新时间:2023-12-02 14:20:01 24 4
gpt4 key购买 nike

如何在休眠条件或命名查询中编写“不存在”查询?我正在尝试获取一个命名查询不存在的查询,该查询返回的结果与此Oracle SQL查询相同:

select *
from SCHOOL a
where not exists (select 1
from STUDENT b
where B.SCHOOL_ID=a.id
and B.STATUS_ID not in (0,1,2,3,4))

最佳答案

在HQL中:

select s from School s where not exists (
select st.id from Student st
where st.school = s
and st.statusId not in (0,1,2,3,4))

关于hibernate - 如何在名为query的grails中编写 “not exists”查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18254268/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com