⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employeebusimp.java

📁 一个hibernate加spring学习的例子
💻 JAVA
字号:
/**
 * 
 */
package com.htxx.demo.bus.imp;

import com.htxx.demo.bus.EmployeeBus;
import com.htxx.demo.model.Employee;
import com.htxx.service.dao.Condition;
import com.htxx.service.dao.GenericDao;
import com.htxx.service.dao.PreloadProps;
import com.htxx.service.dao.PreloadProxy;
import com.htxx.service.dao.ResultSet;

/**
 * @author FanGang
 *
 */
public class EmployeeBusImp implements EmployeeBus {

	private GenericDao dao;
	public GenericDao getDao() {
		return dao;
	}

	public void setDao(GenericDao dao) {
		this.dao = dao;
	}

	/* (non-Javadoc)
	 * @see com.htxx.demo.bus.EmployeeBus#createEmployee(com.htxx.demo.model.Employee)
	 */
	public String createEmployee(Employee emp) {
		return (String)this.getDao().insert(emp);
	}

	/* (non-Javadoc)
	 * @see com.htxx.demo.bus.EmployeeBus#updateEmployee(com.htxx.demo.model.Employee)
	 */
	public void updateEmployee(Employee emp) {
		this.getDao().update(emp);
	}

	/* (non-Javadoc)
	 * @see com.htxx.demo.bus.EmployeeBus#deleteEmployee(java.lang.String)
	 */
	public void deleteEmployee(String id) {
		this.getDao().delete(Employee.class, id);
	}

	/* (non-Javadoc)
	 * @see com.htxx.demo.bus.EmployeeBus#getEmployee(java.lang.String)
	 */
	public Employee getEmployee(String id) {
		Employee emp = (Employee)this.getDao().load(Employee.class, id);
		PreloadProps.preload(emp.getDepartment());
		return emp;
	}

	/* (non-Javadoc)
	 * @see com.htxx.demo.bus.EmployeeBus#findEmployee(com.htxx.service.dao.Condition)
	 */
	public ResultSet findEmployee(Condition condition) {
		return new PreloadProps(this.getDao().query(Employee.class, condition),
				new PreloadProxy(){
					public Object[] PreloadProperty(Object vo) {
						Employee emp = (Employee)vo;
						return new Object[]{emp.getDepartment()};
					}}
		);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -