mangleapplydao.java
来自「spring+hibernate+struts开发的校务oa系统」· Java 代码 · 共 156 行
JAVA
156 行
package com.yondor.oa.db.mangleapply.dao;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Data access object (DAO) for domain model class Mangleapply.
* @see com.yondor.oa.db.Mangleapply
* @author MyEclipse - Hibernate Tools
*/
public class MangleapplyDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(MangleapplyDAO.class);
//property constants
public static final String APPLYCAUSE = "applycause";
public static final String APPLYOP = "applyop";
public static final String REPLYOP = "replyop";
public static final String EQUIPMENT = "equipment";
public static final String ISVIEW = "isview";
public static final String ISFINISH = "isfinish";
protected void initDao() {
//do nothing
}
public void save(Mangleapply transientInstance) {
log.debug("saving Mangleapply instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Mangleapply persistentInstance) {
log.debug("deleting Mangleapply instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Mangleapply findById( java.lang.Long id) {
log.debug("getting Mangleapply instance with id: " + id);
try {
Mangleapply instance = (Mangleapply) getHibernateTemplate()
.get("com.yondor.oa.db.Mangleapply", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Mangleapply instance) {
log.debug("finding Mangleapply 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 Mangleapply instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Mangleapply 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 findByApplycause(Object applycause) {
return findByProperty(APPLYCAUSE, applycause);
}
public List findByApplyop(Object applyop) {
return findByProperty(APPLYOP, applyop);
}
public List findByReplyop(Object replyop) {
return findByProperty(REPLYOP, replyop);
}
public List findByEquipment(Object equipment) {
return findByProperty(EQUIPMENT, equipment);
}
public List findByIsview(Object isview) {
return findByProperty(ISVIEW, isview);
}
public List findByIsfinish(Object isfinish) {
return findByProperty(ISFINISH, isfinish);
}
public Mangleapply merge(Mangleapply detachedInstance) {
log.debug("merging Mangleapply instance");
try {
Mangleapply result = (Mangleapply) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Mangleapply instance) {
log.debug("attaching dirty Mangleapply instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Mangleapply instance) {
log.debug("attaching clean Mangleapply instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static MangleapplyDAO getFromApplicationContext(ApplicationContext ctx) {
return (MangleapplyDAO) ctx.getBean("MangleapplyDAO");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?