您的命名查询无效(
school_id不是
Student实体的属性),这会阻止
SessionFactory实例化。您需要考虑对象和关联,而不是列。尝试以下方法:
from School as swhere not exists ( from Student as st where st.school = s and st.status.id not in (0,1,2,3,4))
参考文献
- Hibernate Core参考指南
- 14.13。子查询

您的命名查询无效(
school_id不是
Student实体的属性),这会阻止
SessionFactory实例化。您需要考虑对象和关联,而不是列。尝试以下方法:
from School as swhere not exists ( from Student as st where st.school = s and st.status.id not in (0,1,2,3,4))