select * from ( select * from department) d
如何为上述查询转换休眠条件查询?
答案 0 :(得分:0)
扩展:
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import javax.persistence.EntityManager;
创建:
@PersistenceContext
private EntityManager entityManager;
public Session getSession() {
return (Session) this.entityManager.getDelegate();
}
然后执行以下操作:
Criteria crit = this.getSession().createCriteria(YourClass.class); return crit.list();
糟糕:此YourClass是实体类