?? tfiledao.java
字號:
package com.richard.model;
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 TFile.
*
* @see com.richard.model.TFile
* @author MyEclipse Persistence Tools
*/
public class TFileDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(TFileDAO.class);
protected void initDao() {
// do nothing
}
public void save(TFile transientInstance) {
log.debug("saving TFile instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(TFile persistentInstance) {
log.debug("deleting TFile instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public TFile findById(java.lang.Long id) {
log.debug("getting TFile instance with id: " + id);
try {
TFile instance = (TFile) getHibernateTemplate().get(
"com.richard.model.TFile", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(TFile instance) {
log.debug("finding TFile 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 TFile instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from TFile 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 findAll() {
log.debug("finding all TFile instances");
try {
String queryString = "from TFile";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public TFile merge(TFile detachedInstance) {
log.debug("merging TFile instance");
try {
TFile result = (TFile) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(TFile instance) {
log.debug("attaching dirty TFile instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TFile instance) {
log.debug("attaching clean TFile instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static TFileDAO getFromApplicationContext(ApplicationContext ctx) {
return (TFileDAO) ctx.getBean("TFileDAO");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -