📄 popedomdao.java
字号:
package com.yondor.oa.db.popedom.dao;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.LockMode;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Expression;
import org.springframework.context.ApplicationContext;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.yondor.oa.db.popedom.iface.IPopedom;
/**
* Data access object (DAO) for domain model class Popedom.
* @see com.yondor.oa.db.pojo.Popedom
* @author MyEclipse - Hibernate Tools
*/
public class PopedomDAO extends HibernateDaoSupport implements IPopedom {
private static final Log log = LogFactory.getLog(PopedomDAO.class);
protected void initDao() {
//do nothing
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#save(com.yondor.oa.db.popedom.dao.Popedom)
*/
public void save(Popedom transientInstance) {
log.debug("saving Popedom instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#delete(com.yondor.oa.db.popedom.dao.Popedom)
*/
public void delete(Popedom persistentInstance) {
log.debug("deleting Popedom instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public List findByEntity(String propertyName,Object value){
return getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(Popedom.class)
.add(Expression.eq(propertyName, value)));
}
public List findAll(){
return getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(Popedom.class));
}
public List getCriteria(DetachedCriteria detachedCriteria){
return getHibernateTemplate().findByCriteria(detachedCriteria);
}
public List findByHql(StringBuffer hql){
return getHibernateTemplate().find(hql.toString());
}
public List findSegment(int firstResult,int maxResults){
return getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(Popedom.class),
firstResult,
maxResults);
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findById(java.lang.Long)
*/
public Popedom findById( java.lang.Long id) {
log.debug("getting Popedom instance with id: " + id);
try {
Popedom instance = (Popedom) getHibernateTemplate()
.get(Popedom.class, id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByExample(com.yondor.oa.db.popedom.dao.Popedom)
*/
public List findByExample(Popedom instance) {
log.debug("finding Popedom 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;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByProperty(java.lang.String, java.lang.Object)
*/
public List findByProperty(String propertyName, Object value) {
log.debug("finding Popedom instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Popedom as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByParentid(java.lang.Object)
*/
public List findByParentid(Object parentid) {
return findByProperty(PARENTID, parentid);
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByIdentifier(java.lang.Object)
*/
public List findByIdentifier(Object identifier) {
return findByProperty(IDENTIFIER, identifier);
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByName(java.lang.Object)
*/
public List findByName(Object name) {
return findByProperty(NAME, name);
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#findByDescription(java.lang.Object)
*/
public List findByDescription(Object description) {
return findByProperty(DESCRIPTION, description);
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#merge(com.yondor.oa.db.popedom.dao.Popedom)
*/
public Popedom merge(Popedom detachedInstance) {
log.debug("merging Popedom instance");
try {
Popedom result = (Popedom) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#attachDirty(com.yondor.oa.db.popedom.dao.Popedom)
*/
public void attachDirty(Popedom instance) {
log.debug("attaching dirty Popedom instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
/* (non-Javadoc)
* @see com.yondor.oa.db.popedom.dao.IPopedom#attachClean(com.yondor.oa.db.popedom.dao.Popedom)
*/
public void attachClean(Popedom instance) {
log.debug("attaching clean Popedom instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static IPopedom getFromApplicationContext(ApplicationContext ctx) {
return (IPopedom) ctx.getBean("PopedomDAO");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -