package com.duan.dao;
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 Cty
* 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.duan.dao.Cty
* @author MyEclipse Persistence Tools
*/
public class CtyDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(CtyDAO.class);
// property constants
public static final String CTY_NAME = "ctyName";
protected void initDao() {
// do nothing
}
public void save(Cty transientInstance) {
log.debug("saving Cty instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Cty persistentInstance) {
log.debug("deleting Cty instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Cty findById(java.lang.Integer id) {
log.debug("getting Cty instance with id: " + id);
try {
Cty instance = (Cty) getHibernateTemplate().get("com.duan.dao.Cty",
id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Cty instance) {
log.debug("finding Cty 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 Cty instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Cty 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 findByCtyName(Object ctyName) {
return findByProperty(CTY_NAME, ctyName);
}
public List findAll() {
log.debug("finding all Cty instances");
try {
String queryString = "from Cty";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Cty merge(Cty detachedInstance) {
log.debug("merging Cty instance");
try {
Cty result = (Cty) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Cty instance) {
log.debug("attaching dirty Cty instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Cty instance) {
log.debug("attaching clean Cty instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static CtyDAO getFromApplicationContext(ApplicationContext ctx) {
return (CtyDAO) ctx.getBean("CtyDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
Java Filter 限制用户浏览权限
共48个文件
xml:8个
tld:7个
class:5个
5星 · 超过95%的资源 需积分: 12 38 下载量 146 浏览量
2010-04-21
19:53:21
上传
评论
收藏 1000KB ZIP 举报
温馨提示
Java Filter 限制用户浏览权限,这是个很简单的例子,初学者也能看懂!
资源推荐
资源详情
资源评论
收起资源包目录
RightManage.zip (48个子文件)
RightManage
.project 2KB
.settings
.jsdtscope 500B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.jsdt.ui.superType.name 6B
.mymetadata 312B
WebRoot
WEB-INF
struts-tiles.tld 8KB
.struts-config.mex 745B
web.xml 1KB
struts-config.xml 943B
struts-bean.tld 9KB
spring-form.tld 49KB
struts-nested.tld 70KB
struts-html.tld 72KB
spring.tld 13KB
struts-logic.tld 14KB
validator-rules.xml 13KB
lib
sqljdbc.jar 227KB
jstl.jar 20KB
commons-dbcp-1.2.1.jar 104KB
commons-pool-1.2.jar 41KB
standard.jar 384KB
classes
com
duan
dao
RightFilter.class 2KB
CtyDAO.class 5KB
Cty.hbm.xml 682B
Cty.class 891B
struts
action
CtyAction.class 2KB
form
CtyForm.class 1KB
ApplicationResources.properties 89B
applicationContext.xml 1KB
index.jsp 275B
META-INF
MANIFEST.MF 36B
add.jsp 580B
ctyList.jsp 612B
database
RoleManage.mdf 3MB
RoleManage_log.ldf 1024KB
.myeclipse
src
com
duan
dao
RightFilter.java 2KB
Cty.java 621B
Cty.hbm.xml 682B
CtyDAO.java 4KB
struts
action
CtyAction.java 1KB
form
CtyForm.java 1KB
ApplicationResources.properties 89B
applicationContext.xml 1KB
hibernate.reveng.xml 420B
.mystrutsdata 255B
.springBeans 462B
.classpath 1KB
.myhibernatedata 606B
共 48 条
- 1
string_99
- 粉丝: 7
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页