package examples.hibernate.dao;

import java.util.List;
import examples.hibernate.entity.Employee;

public interface EmployeeAutoDao {

	public Class BEAN = Employee.class;

	//追加、削除、更新、保存or更新をする場合
	public void save(Employee employee);
	public void delete(Employee employee);
	public void update(Employee employee);
	public void saveOrUpdate(Employee employee);
	
	//HQLを指定しないで実行する場合
	public String getEmployeeByEmpNo_ARGS = "empno";
	public Employee getEmployeeByEmpNo(long empNo);

	public String getEmployeeByJobDeptno_ARGS = "job, deptno";
	public List getEmployeeByJobDeptno(String job, short deptno);
	
	//HQLを指定して実行する場合
	public String getHQLAllEmployee_HQL = "from Employee emp order by emp.empno";
	public List getHQLAllEmployee();

	//何も指定していない場合
	public List getAllEmployee();

	//firstResult,maxResultsを指定する場合
	public String getEmployeeList_ARGS = "firstResult,maxResults";
	public String getEmployeeList_HQL = "from Employee emp order by emp.empno";
	public List getEmployeeList(int firstResult ,int MaxResults );

	//戻り値がintの場合
	public String getEmployeeCount_HQL = "select count(emp) from Employee emp";
	public int getEmployeeCount();

	//戻り値がStringの場合
	public String getEmployeeNameById_HQL 
				= "select emp.ename from Employee emp where empno = :employeeId ";
	public String getEmployeeNameById_ARGS = "employeeId";
	public String getEmployeeNameById(Long employeeId);

	//NamedQuery呼び出しを使う場合
	//(Employee.hbm.xmlの"examples.hibernate.dao.EmployeeAutoDao_getEmployeeByJob"に対応)
	public String getEmployeeByJob_ARGS = "job";
	public List getEmployeeByJob(String job);

	//NamedQueryで戻り値がStringになるようなSQL文を使う場合
	//(Employee.hbm.xmlの"examples.hibernate.dao.EmployeeAutoDao_getSQLEmployeeNameById"に対応)
	public String getSQLEmployeeNameById_ARGS = "employeeId";
	public String getSQLEmployeeNameById(Long employeeId);	
	
	//NamedQueryで戻り値がLongになるようなSQL文を使う場合
	//(Employee.hbm.xmlの"getSQLEmployeeIdByName"NamedQueryを実行)
	public String getSQLEmployeeIdByName_ARGS = "employeeName";
	public Long getSQLEmployeeIdByName(String employeeName);
}
