它似乎是重复的问题,但我的问题不是解决。我有以下表格: -
------------------------------------------------------
student student_fine
st_id fine_id
st_name fine_description
st_class fine_amount
st_id
-------------------------------------------------------
query required: "SELECT * FROM STUDENT WHERE STUDENT.ST_ID NOT IN
(SELECT STUDENT_FINE.ST_ID FROM STUDENT)"
criteria query code i used:
Criteria criteria = session.createCriteria(Student.class);
DetachedCriteria detachedcriteria = DetachedCriteria.forClass(StudentFine.class);
detachedcriteria.setProjection(Property.forName("st_id"));
criteria.add(Property.forName("st_id").notIn(detachedcriteria));
...
我得到一个没有记录的列表,而sql命令行返回2条记录。我做错了什么?