package com.atguigu.ssh.dao; import java.util.List; import org.hibernate.Query; import com.atguigu.ssh.entities.Employee; public class EmployeeDao extends BaseDao{ public void delete(Integer id){ String hql = "DELETE FROM Employee e WHERE e.id = ?"; getSession().createQuery(hql).setInteger(0, id).executeUpdate(); } public List<Employee> getAll(){ String hql = "FROM Employee e LEFT OUTER JOIN FETCH e.department"; return getSession().createQuery(hql).list(); } public void saveOrUpdate(Employee employee){ getSession().saveOrUpdate(employee); } public Employee getEmployeeByLastName(String lastName){ String hql = "FROM Employee e WHERE e.lastName = ?"; Query query = getSession().createQuery(hql).setString(0, lastName); Employee employee = (Employee) query.uniqueResult(); System.out.println(employee.getDepartment().getClass().getName()); return employee; } public Employee get(Integer id){ return (Employee) getSession().get(Employee.class, id); } }

and123456 LV11
2022年3月16日
mrmrmr2333 LV4
2020年11月5日
yep123 LV2
2020年6月29日
zhaowenbin LV6
2019年6月17日
aa991215 LV17
2019年6月1日
zxcvbnmasfghjkl LV8
2019年5月29日
chenlinkai LV8
2019年4月24日
1206207437 LV8
2019年4月23日
1763157114 LV15
2018年12月31日
hu0336 LV10
2018年12月26日

WBelong LV8
2024年9月9日
陈小灏 LV18
2024年6月26日
zhaoming200677 LV13
2023年4月18日
ethanmilk
2023年1月13日
暂无贡献等级
745742217
2022年4月27日
暂无贡献等级
shamexidan LV9
2022年3月26日
yuwucaia LV1
2022年1月26日
微信网友_5766146313375744
2021年12月29日
暂无贡献等级
过过成功尺寸 LV7
2021年11月24日
yexiansheng LV1
2021年11月6日