Criteria criteria = session.createCriteria(Student.class);
criteria.add(Restrictions.eq(STD_ID, stdId));
criteria.add(Restrictions.le(START_DATE, dateOfService));
criteria.add(Restrictions.ge(END_DATE, dateOfService));
results = criteria.list();
是否可以将criteria对象转换为SQL查询,或者在Eclipse中调试时是否可以查看生成的SQL查询?
答案 0 :(得分:1)
使用条件API无法做到,但有一些解决方法: How to get SQL from Hibernate Criteria API (*not* for logging)