HIbernate的hibernateTemplate.findByCriteria用法

package com.dao.impl;


import java.util.List;


import javax.annotation.Resource;


import org.hibernate.criterion.DetachedCriteria;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;


import com.dao.UserDao;
import com.entity.User;
@Repository
public class UserDaoImpl implements UserDao{


@Resource
private HibernateTemplate hibernateTemplate;
@Override
public void add() {
// TODO Auto-generated method stub

}


@Override
public User U_login(String name, String pwd) {
DetachedCriteria criteria=DetachedCriteria.forClass(User.class);
  hibernateTemplate.findByCriteria(criteria);//查询所有对象
  hibernateTemplate.findByCriteria(criteria, 1, 3);//分页查询
return null;
}


}

你可能感兴趣的:(HIbernate,mvc,hibernate)