package com.tcs.hrr.service.impl;
import java.util.List;
import com.tcs.hrr.dao.UserDAO;
import com.tcs.hrr.domain.User;
import com.tcs.hrr.service.UserManager;
public class UserManagerImpl implements UserManager {
protected UserDAO userDao= null;
public UserDAO getUserDao() {
return userDao;
}
public void setUserDao(UserDAO userDao) {
this.userDao = userDao;
}
@Override
public User findUserById(Integer id) {
// TODO Auto-generated method stub
return userDao.findById(id);
}
@Override
public int insertUser() {
User user = new User();
user.setName("test2");
userDao.save(user);
return 0;
}
@Override
public void mergeUser(User user) {
this.userDao.merge(user);
}
@Override
public List findUserByNameAndPwd(String username, String password) {
String stringQuery = "from User user where user.name='"+username+"' and user.password='"+password+"'";
return this.userDao.findBySQL(stringQuery);
}
}