📄 changescheduledao.java
字号:
package org.mychange.obj;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.mychange.dao.IChangescheduleDAO;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Data access object (DAO) for domain model class Changeschedule.
*
* @see org.mychange.obj.Changeschedule
* @author MyEclipse Persistence Tools
*/
public class ChangescheduleDAO extends HibernateDaoSupport implements IChangescheduleDAO{
private static final Log log = LogFactory.getLog(ChangescheduleDAO.class);
// property constants
public static final String MANAGER_NUM = "managerNum";
public static final String STAFF_NUM = "staffNum";
public static final String EARLIEST_TIME = "earliestTime";
public static final String LATEST_TIME = "latestTime";
public static final String BEGIN_TIME = "beginTime";
public static final String END_TIME = "endTime";
public static final String SKILL_REQUIREMENT = "skillRequirement";
public static final String DEPARTMENT_NAME = "departmentName";
public static final String MIN_COST = "minCost";
public static final String MAX_COST = "maxCost";
public static final String MONEY = "money";
public static final String PHASE = "phase";
protected void initDao() {
// do nothing
}
public void save(Changeschedule transientInstance) {
log.debug("saving Changeschedule instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void update(Changeschedule cc){
getHibernateTemplate().update(cc);
}
public void delete(Changeschedule persistentInstance) {
log.debug("deleting Changeschedule instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Changeschedule findById(java.lang.Integer id) {
log.debug("getting Changeschedule instance with id: " + id);
try {
Changeschedule instance = (Changeschedule) getHibernateTemplate()
.get("org.mychange.obj.Changeschedule", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Changeschedule instance) {
log.debug("finding Changeschedule instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Changeschedule instance with property: "
+ propertyName + ", value: " + value);
try {
String queryString = "from Changeschedule as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByManagerNum(Object managerNum) {
return findByProperty(MANAGER_NUM, managerNum);
}
public List findByStaffNum(Object staffNum) {
return findByProperty(STAFF_NUM, staffNum);
}
public List findByEarliestTime(Object earliestTime) {
return findByProperty(EARLIEST_TIME, earliestTime);
}
public List findByLatestTime(Object latestTime) {
return findByProperty(LATEST_TIME, latestTime);
}
public List findByBeginTime(Object beginTime) {
return findByProperty(BEGIN_TIME, beginTime);
}
public List findByEndTime(Object endTime) {
return findByProperty(END_TIME, endTime);
}
public List findBySkillRequirement(Object skillRequirement) {
return findByProperty(SKILL_REQUIREMENT, skillRequirement);
}
public List findByDepartmentName(Object departmentName) {
return findByProperty(DEPARTMENT_NAME, departmentName);
}
public List findByMinCost(Object minCost) {
return findByProperty(MIN_COST, minCost);
}
public List findByMaxCost(Object maxCost) {
return findByProperty(MAX_COST, maxCost);
}
public List findByMoney(Object money) {
return findByProperty(MONEY, money);
}
public List findByPhase(Object phase) {
return findByProperty(PHASE, phase);
}
public List findAll() {
log.debug("finding all Changeschedule instances");
try {
String queryString = "from Changeschedule";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Changeschedule merge(Changeschedule detachedInstance) {
log.debug("merging Changeschedule instance");
try {
Changeschedule result = (Changeschedule) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Changeschedule instance) {
log.debug("attaching dirty Changeschedule instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Changeschedule instance) {
log.debug("attaching clean Changeschedule instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static ChangescheduleDAO getFromApplicationContext(
ApplicationContext ctx) {
return (ChangescheduleDAO) ctx.getBean("ChangescheduleDAO");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -