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 spring hibernate实用整合实例2
共153个文件
jar:66个
xml:22个
class:21个
需积分: 3 46 下载量 130 浏览量
2008-09-12
11:48:21
上传
评论
收藏 14.3MB RAR 举报
温馨提示
1,spring声明事务和其它aop结合使用 2,hibernate多表(一对多/多对一,一对一,多对多)关联查询和添加 3,建数据库表的sql生成文件, 4,我也是初学者,这是我都调试成功的,用的是jdk1.4,sql server 2005,有什么不对的地方,还请大家多指正。 E-mail:xiaoyongboy1010@yahoo.com.cn
资源推荐
资源详情
资源评论
收起资源包目录
struts spring hibernate实用整合实例2 (153个子文件)
UserInfoDAO.class 6KB
UsersauthDAO.class 5KB
OrderitemDAO.class 5KB
CardDAO.class 5KB
CustomerDAO.class 5KB
ServiceTarget.class 5KB
OrdersDAO.class 5KB
UsersDAO.class 5KB
AuthDAO.class 5KB
UserInfo.class 2KB
LoginAction.class 2KB
Card.class 1KB
Customer.class 1KB
Orderitem.class 1KB
LoginForm.class 1KB
Users.class 1KB
Orders.class 1KB
Auth.class 1KB
Usersauth.class 1KB
LogAdvice.class 625B
Service.class 343B
.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
ServiceTarget.java 5KB
CardDAO.java 4KB
UsersauthDAO.java 4KB
OrderitemDAO.java 4KB
CustomerDAO.java 4KB
OrdersDAO.java 4KB
UsersDAO.java 4KB
AuthDAO.java 4KB
UserInfo.java 3KB
LoginAction.java 2KB
LoginForm.java 1KB
共 153 条
- 1
- 2
资源评论
xiaoyongboy1010
- 粉丝: 7
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功