📄 topicdao.java
字号:
package com.yondor.oa.db.topic.dao;
import java.util.Date;
import java.util.List;
import java.util.Set;
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 Topic.
* @see com.yondor.oa.db.Topic
* @author MyEclipse - Hibernate Tools
*/
public class TopicDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(TopicDAO.class);
//property constants
public static final String TOP = "top";
public static final String CONTENTTAG = "contenttag";
public static final String DISTILLATE = "distillate";
public static final String TITLE = "title";
public static final String FACE = "face";
public static final String TEMP = "temp";
protected void initDao() {
//do nothing
}
public void save(Topic transientInstance) {
log.debug("saving Topic instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Topic persistentInstance) {
log.debug("deleting Topic instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Topic findById( java.lang.Long id) {
log.debug("getting Topic instance with id: " + id);
try {
Topic instance = (Topic) getHibernateTemplate()
.get(Topic.class, id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Topic instance) {
log.debug("finding Topic 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 Topic instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Topic 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 findByTop(Object top) {
return findByProperty(TOP, top);
}
public List findByContenttag(Object contenttag) {
return findByProperty(CONTENTTAG, contenttag);
}
public List findByDistillate(Object distillate) {
return findByProperty(DISTILLATE, distillate);
}
public List findByTitle(Object title) {
return findByProperty(TITLE, title);
}
public List findByFace(Object face) {
return findByProperty(FACE, face);
}
public List findByTemp(Object temp) {
return findByProperty(TEMP, temp);
}
public Topic merge(Topic detachedInstance) {
log.debug("merging Topic instance");
try {
Topic result = (Topic) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Topic instance) {
log.debug("attaching dirty Topic instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Topic instance) {
log.debug("attaching clean Topic instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static TopicDAO getFromApplicationContext(ApplicationContext ctx) {
return (TopicDAO) ctx.getBean("TopicDAO");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -