📄 testreportdao.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.ITestreportDAO;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Data access object (DAO) for domain model class Testreport.
*
* @see org.mychange.obj.Testreport
* @author MyEclipse Persistence Tools
*/
public class TestreportDAO extends HibernateDaoSupport implements ITestreportDAO {
private static final Log log = LogFactory.getLog(TestreportDAO.class);
// property constants
public static final String TEST_REPORT_NAME = "testReportName";
public static final String BEGIN_TIME = "beginTime";
public static final String END_TIME = "endTime";
public static final String PRINCIPAL = "principal";
public static final String BRIEF = "brief";
public static final String ATTACHMENT = "attachment";
public static final String SCORE = "score";
protected void initDao() {
// do nothing
}
public void save(Testreport transientInstance) {
log.debug("saving Testreport instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void update(Testreport tr){
getHibernateTemplate().update(tr);
}
public void delete(Testreport persistentInstance) {
log.debug("deleting Testreport instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Testreport findById(java.lang.Integer id) {
log.debug("getting Testreport instance with id: " + id);
try {
Testreport instance = (Testreport) getHibernateTemplate().get(
"org.mychange.obj.Testreport", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Testreport instance) {
log.debug("finding Testreport 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 Testreport instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Testreport 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 findByTestReportName(Object testReportName) {
return findByProperty(TEST_REPORT_NAME, testReportName);
}
public List findByBeginTime(Object beginTime) {
return findByProperty(BEGIN_TIME, beginTime);
}
public List findByEndTime(Object endTime) {
return findByProperty(END_TIME, endTime);
}
public List findByPrincipal(Object principal) {
return findByProperty(PRINCIPAL, principal);
}
public List findByBrief(Object brief) {
return findByProperty(BRIEF, brief);
}
public List findByAttachment(Object attachment) {
return findByProperty(ATTACHMENT, attachment);
}
public List findByScore(Object score) {
return findByProperty(SCORE, score);
}
public List findAll() {
log.debug("finding all Testreport instances");
try {
String queryString = "from Testreport";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Testreport merge(Testreport detachedInstance) {
log.debug("merging Testreport instance");
try {
Testreport result = (Testreport) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Testreport instance) {
log.debug("attaching dirty Testreport instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Testreport instance) {
log.debug("attaching clean Testreport instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static TestreportDAO getFromApplicationContext(ApplicationContext ctx) {
return (TestreportDAO) ctx.getBean("TestreportDAO");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -