hibernate Criteria 高级查询in 查询 或or查询使用方法

in查询:

public List<ArchivesApplication> getPostList(String[] status) throws AppException {
   Criteria criteria = this.getSession().createCriteria(ArchivesApplication.class);
   criteria.add(Property.forName("status").in(status));
   return criteria.list();
}

String status[] = {"101","104","109"};
    archivesAppList = archivesApplicationDAO.getPostList(status);

or 查询

criteria.add(Restrictions.or(Restrictions.eq("boxNo", boxNo)
      ,Restrictions.eq("folderNo", boxNo)));

 

 

if(startTime!=null){
    criteria.add(Restrictions.ge("applicationDate", startTime));
   }

你可能感兴趣的:(Hibernate)