package com.ssh.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.ssh.entities.Employee;

public class EmployeeDao extends BaseDao{

	public List<Employee> getAll(){
		String hql=" FROM Employee e Left outer join fetch e.department";
		
         Session s =getSession();
        
		return s.createQuery(hql).list();

	}
	public void delete(Integer id){
		String hql="delete from Employee where id=?";
		getSession().createQuery(hql).setInteger(0, id).executeUpdate();
	}
	public void saveOrUpdate(Employee employee){
		getSession().saveOrUpdate(employee);
	}
	public Employee getEmployeeByLastName(String lastName){
		String hql="From Employee e where lastName=?";
		Query query =getSession().createQuery(hql);
		query.setString(0, lastName);
		return (Employee) query.uniqueResult();
		
	}
	public Employee getEmployee(Integer id){
		return (Employee) getSession().get(Employee.class,id);
		
	}

}
最近下载更多
uuuuuuuuuuuwwwwww  LV3 2021年12月14日
漫长的白日梦  LV8 2021年12月8日
fmmjjj  LV3 2020年6月26日
lokpjikjf  LV7 2020年5月27日
zhangnq  LV6 2020年5月25日
yangyufan229  LV1 2020年5月24日
秘制酒心巧克力  LV6 2020年4月13日
lwaizy  LV3 2019年12月21日
13148918399  LV9 2019年12月9日
abdkfksdkf  LV15 2019年11月19日
最近浏览更多
3516569014  LV5 2023年5月7日
星辰xc  LV2 2023年5月7日
似鹤不是鹤似鹤不是鹤  LV1 2023年5月5日
彩色天空  LV5 2023年4月2日
暂无贡献等级
uni-code_0123  LV1 2022年11月16日
磊哥哥哥哥  LV13 2022年5月30日
lihuazhen  LV2 2021年12月15日
uuuuuuuuuuuwwwwww  LV3 2021年12月14日
jianzhaodi  LV2 2021年12月14日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友