package com.hibernate;
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 Users.
*
* @see com.hibernate.Users
* @author MyEclipse Persistence Tools
*/
public class UsersDAO extends HibernateDaoSupport {
/*private static final Log log = LogFactory.getLog(UsersDAO.class);
// property constants
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
protected void initDao() {
// do nothing
}
public void save(Users transientInstance) {
log.debug("saving Users instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Users persistentInstance) {
log.debug("deleting Users instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Users findById(java.lang.Long id) {
log.debug("getting Users instance with id: " + id);
try {
Users instance = (Users) getHibernateTemplate().get(
"com.hibernate.Users", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Users instance) {
log.debug("finding Users 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 Users instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Users 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 findByUsername(Object username) {
return findByProperty(USERNAME, username);
}
public List findByPassword(Object password) {
return findByProperty(PASSWORD, password);
}
public List findAll() {
log.debug("finding all Users instances");
try {
String queryString = "from Users";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Users merge(Users detachedInstance) {
log.debug("merging Users instance");
try {
Users result = (Users) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Users instance) {
log.debug("attaching dirty Users instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Users instance) {
log.debug("attaching clean Users instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static UsersDAO getFromApplicationContext(ApplicationContext ctx) {
return (UsersDAO) ctx.getBean("UsersDAO");
}*/
}
没有合适的资源?快使用搜索试试~ 我知道了~
oracle+struts2.0+hibernate3.1+spring2.0实验代码与前面发布的实验指导配套
共44个文件
java:11个
class:11个
xml:7个
4星 · 超过85%的资源 需积分: 5 525 下载量 47 浏览量
2007-07-15
20:42:55
上传
评论
收藏 33KB RAR 举报
温馨提示
oracle+struts2.0+hibernate3.1+spring2.0实验代码与前面发布的实验指导配套,由于所需要的包实在太打,所以请你们根据实验指导到相应地方找,实在找不到请email: haoxing272@gmail.com<br>一起努力…………
资源推荐
资源详情
资源评论
收起资源包目录
aaa.rar (44个子文件)
aaa
.project 2KB
user.sql 417B
.mymetadata 282B
WebRoot
WEB-INF
web.xml 2KB
spring-form.tld 51KB
spring.tld 13KB
lib
classes
log4j.properties 1KB
struts.properties 7KB
com
hibernate
AbstractUsers.class 1KB
Users.class 557B
Users.hbm.xml 929B
UsersDAO.class 323B
action
UserManage.class 2KB
filter
NewFilterDispatcher.class 1KB
SetCharacterEncodingFilter.class 2KB
service
UserService.class 302B
impl
UserServiceImpl.class 1KB
util
BaseService.class 2KB
BaseAction.class 273B
BaseObject.class 2KB
applicationContext.xml 2KB
struts.xml 638B
index.jsp 1KB
META-INF
MANIFEST.MF 39B
next.jsp 1KB
.myeclipse
src
log4j.properties 1KB
struts.properties 7KB
com
hibernate
Users.java 473B
UsersDAO.java 4KB
AbstractUsers.java 941B
Users.hbm.xml 929B
action
UserManage.java 1KB
filter
SetCharacterEncodingFilter.java 1KB
NewFilterDispatcher.java 998B
service
UserService.java 302B
impl
UserServiceImpl.java 752B
util
BaseAction.java 125B
BaseObject.java 1KB
BaseService.java 1KB
applicationContext.xml 2KB
struts.xml 638B
.springBeans 320B
.classpath 8KB
.myhibernatedata 521B
共 44 条
- 1
资源评论
- qww00102015-11-26不错啦、很详细
- kimmy1072014-07-08内容挺简单的,适合初学者
haoxing272
- 粉丝: 13
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功