package user_info;
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 UserInfo.
* @see user_info.UserInfo
* @author MyEclipse - Hibernate Tools
*/
public class UserInfoDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(UserInfoDAO.class);
//property constants
public static final String LOGIN_NAME = "loginName";
public static final String USER_PASSWORD = "userPassword";
public static final String USER_NAME = "userName";
public static final String MOBILE_PHONE = "mobilePhone";
public static final String TELEPHONE = "telephone";
public static final String ADDRESS = "address";
public static final String EMAIL = "email";
protected void initDao() {
//do nothing
}
public void save(UserInfo transientInstance){
log.debug("deleting UserInfo instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(UserInfo persistentInstance) {
log.debug("deleting UserInfo instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public UserInfo findById( java.lang.Integer id) {
log.debug("getting UserInfo instance with id: " + id);
try {
UserInfo instance = (UserInfo) getHibernateTemplate()
.get("user_info.UserInfo", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(UserInfo instance) {
log.debug("finding UserInfo 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 UserInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from UserInfo 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 findByLoginName(Object loginName) {
return findByProperty(LOGIN_NAME, loginName);
}
public List findByUserPassword(Object userPassword) {
return findByProperty(USER_PASSWORD, userPassword);
}
public List findByUserName(Object userName) {
return findByProperty(USER_NAME, userName);
}
public List findByMobilePhone(Object mobilePhone) {
return findByProperty(MOBILE_PHONE, mobilePhone);
}
public List findByTelephone(Object telephone) {
return findByProperty(TELEPHONE, telephone);
}
public List findByAddress(Object address) {
return findByProperty(ADDRESS, address);
}
public List findByEmail(Object email) {
return findByProperty(EMAIL, email);
}
public UserInfo merge(UserInfo detachedInstance) {
log.debug("merging UserInfo instance");
try {
UserInfo result = (UserInfo) getHibernateTemplate()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(UserInfo instance) {
log.debug("attaching dirty UserInfo instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(UserInfo instance) {
log.debug("attaching clean UserInfo instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static UserInfoDAO getFromApplicationContext(ApplicationContext ctx) {
return (UserInfoDAO) ctx.getBean("UserInfoDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
struts hibernate spring 实用整合
共109个文件
jar:66个
class:7个
java:7个
需积分: 0 16 下载量 98 浏览量
2008-09-10
09:42:05
上传
评论
收藏 14.26MB RAR 举报
温馨提示
struts hibernate spring 实用整合 spring的配置文件(applicationContext.xml)中,配置了事务和一个日志功能的AOP的结合,是非常具有实用价值的针对初学者的入门实例。
资源详情
资源评论
资源推荐
收起资源包目录
struts hibernate spring 实用整合 (109个子文件)
UserInfoDAO.class 6KB
UserInfo.class 2KB
LoginAction.class 2KB
ServiceTarget.class 2KB
LoginForm.class 1KB
LogAdvice.class 625B
Service.class 267B
.classpath 5KB
hibernate3.jar 1.6MB
itext-1.3.jar 1.09MB
db-ojb-1.0.4.jar 917KB
jasperreports-1.0.3.jar 843KB
poi-2.5.1.jar 783KB
freemarker.jar 771KB
jxl.jar 597KB
commons-collections.jar 546KB
struts.jar 486KB
c3p0-0.9.0.4.jar 479KB
antlr-2.7.5H3.jar 423KB
quartz-1.5.2.jar 380KB
jmxri.jar 357KB
velocity-1.4.jar 353KB
log4j-1.2.13.jar 350KB
cglib-nodep-2.1_3.jar 317KB
dom4j-1.6.jar 306KB
ibatis-sqlmap-2.jar 298KB
jtds-1.2.jar 279KB
commons-httpclient.jar 273KB
jaxen-1.1-beta-4.jar 233KB
spring-beans.jar 227KB
spring-webmvc.jar 206KB
commons-lang.jar 203KB
jmxremote_optional.jar 202KB
spring-hibernate.jar 190KB
commons-beanutils.jar 184KB
spring-jdbc.jar 182KB
spring-orm.jar 177KB
jmxremote.jar 172KB
commons-digester.jar 164KB
spring-support.jar 162KB
spring-aop.jar 155KB
spring-web.jar 140KB
spring-remoting.jar 137KB
hibernate-annotations.jar 128KB
jotm.jar 121KB
spring-core.jar 119KB
junit.jar 118KB
ibatis-sqlmap.jar 117KB
spring-context.jar 107KB
commons-dbcp.jar 105KB
spring-dao.jar 93KB
xapool.jar 90KB
JAMon.jar 88KB
ibatis-common-2.jar 83KB
burlap-2.1.12.jar 83KB
hessian-2.1.12.jar 81KB
jdo2.jar 74KB
velocity-tools-view-1.2.jar 67KB
jakarta-oro.jar 64KB
jakarta-oro-2.0.8.jar 64KB
cos.jar 55KB
toplink-api.jar 50KB
ehcache-1.1.jar 46KB
commons-validator.jar 46KB
spring-mock.jar 44KB
commons-pool.jar 41KB
commons-logging.jar 37KB
easymock.jar 36KB
commons-attributes-api.jar 35KB
commons-attributes-compiler.jar 29KB
commons-fileupload.jar 22KB
velocity-tools-generic-1.2.jar 18KB
easymockclassextension.jar 12KB
struts-legacy.jar 10KB
UserInfoDAO.java 5KB
UserInfo.java 3KB
LoginForm.java 1KB
LoginAction.java 1KB
ServiceTarget.java 983B
LogAdvice.java 516B
Service.java 234B
index.jsp 530B
fail.jsp 370B
suc.jsp 369B
.struts-config.mex 1KB
MANIFEST.MF 39B
.myhibernatedata 473B
.mymetadata 297B
.mystrutsdata 246B
.project 2KB
log4j.properties 630B
log4j.properties 630B
ApplicationResources.properties 75B
ApplicationResources.properties 75B
.springBeans 283B
struts-html.tld 65KB
struts-nested.tld 63KB
struts-logic.tld 14KB
struts-bean.tld 9KB
struts-tiles.tld 8KB
共 109 条
- 1
- 2
xiaoyongboy1010
- 粉丝: 7
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0