HIBERNATE数据检索示例
1,Criteria Query
面向对象化设计,
Crireria criteria =session.createCriteria(Tuser.class)
Criteria.add(Expression.eq(“name”, “erica”));
Criteria.ass(Expression.eq(“sex”, new Ineteger(1)));
Criteria.setFirstResult(100);
Criteria.setMaxResults(20);
Critetia.addOrder(order.asc(“name”));
2, Hibernate Query Language(HQL)
String hql=”from org.hibernate.smaple.Tuser as user where user.name=’Erica’”;
Query query=session.createQuery(hql);
List userList=query.list();