package test;
import java.util.Date;
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;
/**
* A data access object (DAO) providing persistence and search support for
* CnCdsDict entities. Transaction control of the save(), update() and delete()
* operations can directly support Spring container-managed transactions or they
* can be augmented to handle user-managed Spring transactions. Each of these
* methods provides additional information for how to configure it for the
* desired type of transaction control.
*
* @see test.CnCdsDict
* @author MyEclipse Persistence Tools
*/
public class CnCdsDictDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(CnCdsDictDAO.class);
// property constants
public static final String DICT_NAME = "dictName";
public static final String DICT_TYPE = "dictType";
public static final String DICT_CODE = "dictCode";
public static final String OP_NAME = "opName";
public static final String OP_IP = "opIp";
public static final String STATUS = "status";
protected void initDao() {
// do nothing
}
public void save(CnCdsDict transientInstance) {
log.debug("saving CnCdsDict instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(CnCdsDict persistentInstance) {
log.debug("deleting CnCdsDict instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public CnCdsDict findById(java.lang.Long id) {
log.debug("getting CnCdsDict instance with id: " + id);
try {
CnCdsDict instance = (CnCdsDict) getHibernateTemplate().get(
"test.CnCdsDict", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(CnCdsDict instance) {
log.debug("finding CnCdsDict 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 CnCdsDict instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from CnCdsDict 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 findByDictName(Object dictName) {
return findByProperty(DICT_NAME, dictName);
}
public List findByDictType(Object dictType) {
return findByProperty(DICT_TYPE, dictType);
}
public List findByDictCode(Object dictCode) {
return findByProperty(DICT_CODE, dictCode);
}
public List findByOpName(Object opName) {
return findByProperty(OP_NAME, opName);
}
public List findByOpIp(Object opIp) {
return findByProperty(OP_IP, opIp);
}
public List findByStatus(Object status) {
return findByProperty(STATUS, status);
}
public List findAll() {
log.debug("finding all CnCdsDict instances");
try {
String queryString = "from CnCdsDict";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public CnCdsDict merge(CnCdsDict detachedInstance) {
log.debug("merging CnCdsDict instance");
try {
CnCdsDict result = (CnCdsDict) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(CnCdsDict instance) {
log.debug("attaching dirty CnCdsDict instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(CnCdsDict instance) {
log.debug("attaching clean CnCdsDict instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static CnCdsDictDAO getFromApplicationContext(ApplicationContext ctx) {
return (CnCdsDictDAO) ctx.getBean("CnCdsDictDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
www.rar (35个子文件)
www
.springBeans 320B
src
applicationContext.xml 1KB
log4j.properties 2KB
xwork.xml 471B
webwork.properties 91B
test
CnCdsDictDAO.java 5KB
AbstractCnCdsDict.java 2KB
CnCdsDict.hbm.xml 1KB
HibernateSessionFactory.java 3KB
CnCdsDict.java 699B
SpringTest.java 816B
ActionTest.java 884B
.classpath 8KB
.mymetadata 282B
.myeclipse
.project 2KB
WebRoot
META-INF
MANIFEST.MF 39B
index.jsp 829B
test
act.jsp 847B
WEB-INF
classes
applicationContext.xml 1KB
log4j.properties 2KB
xwork.xml 471B
webwork.properties 91B
test
SpringTest.class 2KB
ActionTest.class 2KB
CnCdsDict.hbm.xml 1KB
AbstractCnCdsDict.class 3KB
CnCdsDict.class 941B
CnCdsDictDAO.class 6KB
HibernateSessionFactory.class 2KB
spring.tld 13KB
lib
spring.jar 2.29MB
webwork.tld 376KB
spring-form.tld 51KB
web.xml 1KB
.myhibernatedata 521B
共 35 条
- 1
资源评论
被人抢先注册了昵称的小泥鳅
- 粉丝: 15
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功