/** * @see com.sol.eyeq.model.service.test.ManyToOneProfessorDao#createProfessor(java.lang.String, * long) */ public ManyToOneProfessor createProfessor(String name, long salary) { ManyToOneProfessor emp = new ManyToOneProfessor(); emp.setName(name); emp.setSalary(salary); getSessionFactory().getCurrentSession().persist(emp); return emp; }
/** @see com.sol.eyeq.model.service.test.ManyToOneProfessorDao#setProfessorDepartment(int, int) */ public ManyToOneProfessor setProfessorDepartment(int empId, int deptId) { ManyToOneProfessor emp = (ManyToOneProfessor) getSessionFactory() .getCurrentSession() .createQuery("from ManyToOneProfessor where id=?") .setParameter(0, empId) .list() .get(0); ManyToOneDepartment dept = (ManyToOneDepartment) getSessionFactory() .getCurrentSession() .createQuery("from ManyToOneDepartment where id=?") .setParameter(0, deptId) .list() .get(0); emp.setDepartment(dept); return emp; }