package com.hibernate.dao;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.hibernate.entity.Info;
/**
* A data access object (DAO) providing persistence and search support for Info
* 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 com.hibernate.entity.Info
* @author MyEclipse Persistence Tools
*/
public class InfoDAO extends BaseHibernateDAOImp {
private static final Log log = LogFactory.getLog(InfoDAO.class);
public void save(Info transientInstance) {
log.debug("saving Info instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Info persistentInstance) {
log.debug("deleting Info instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Info findById(java.lang.Integer id) {
log.debug("getting Info instance with id: " + id);
try {
Info instance = (Info) getSession().get(
"com.hibernate.entity.Info", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List<Info> findByProperty(String propertyName, Object value) {
log.debug("finding Info instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Info as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List<Info> findAll() {
log.debug("finding all Info instances");
try {
String queryString = "from Info";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
ZK+spring+hibernate的整合
共27个文件
java:7个
class:7个
xml:5个
5星 · 超过95%的资源 需积分: 9 128 下载量 135 浏览量
2010-05-23
10:15:24
上传
评论
收藏 16KB RAR 举报
温馨提示
在自个学习zk和其他两个框架整合的时候,总是找不到合适的整合demo进行参考,希望此次上传能对初学者有用
资源推荐
资源详情
资源评论
收起资源包目录
zk.rar (27个子文件)
zk
.project 2KB
.settings
org.eclipse.jdt.core.prefs 330B
.mymetadata 279B
WebRoot
WEB-INF
web.xml 7KB
spring-config.xml 2KB
lib
classes
com
hibernate
dao
InfoDAO.class 3KB
BaseHibernateDAOImp.class 406B
BaseHibernateDAO.class 131B
entity
Info.hbm.xml 786B
Info.class 1KB
zk
MyComposer.class 2KB
service
Service.class 159B
ServiceImp.class 939B
hibernate.cfg.xml 450B
META-INF
MANIFEST.MF 39B
index.zul 772B
.myeclipse
src
com
hibernate
dao
BaseHibernateDAO.java 98B
BaseHibernateDAOImp.java 509B
InfoDAO.java 3KB
entity
Info.hbm.xml 786B
Info.java 948B
zk
MyComposer.java 1KB
service
ServiceImp.java 597B
Service.java 182B
.springBeans 420B
.classpath 7KB
.myhibernatedata 532B
共 27 条
- 1
com_d_d
- 粉丝: 7
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页