package com.woniuxy.ssh.po;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.CacheMode;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* A data access object (DAO) providing persistence and search support for
* Person 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.woniuxy.ssh.po.Person
* @author MyEclipse Persistence Tools
*/
public class PersonDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(PersonDAO.class);
// property constants
public static final String AGE = "age";
public static final String ADDRESS = "address";
public static final String NAME = "name";
protected void initDao() {
// do nothing
}
public void save(Person transientInstance) {
log.debug("saving Person instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Person persistentInstance) {
log.debug("deleting Person instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Person findById(java.lang.Integer id) {
log.debug("getting Person instance with id: " + id);
try {
Person instance = (Person) getHibernateTemplate().get("com.woniuxy.ssh.po.Person", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Person instance) {
log.debug("finding Person 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 Person instance with property: " + propertyName + ", value: " + value);
try {
String queryString = "from Person 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 findByAge(Object age) {
return findByProperty(AGE, age);
}
public List findByAddress(Object address) {
return findByProperty(ADDRESS, address);
}
public List findByName(Object name) {
return findByProperty(NAME, name);
}
public List findAll() {
log.debug("finding all Person instances");
try {
Session session = this.getSession();
String queryString = "from Person";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public List findAll(int page) {
log.debug("finding all Person instances");
try {
Session session = this.getSession();
String queryString = "from Person";
Query query = session.createQuery(queryString);
query.setFirstResult((page-1)*5);
query.setMaxResults(5);
// query.setCacheable(true);
// query.setCacheMode(CacheMode.parse("demo"));
List<Person> list = query.list();
// session.close();
return list;
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Person merge(Person detachedInstance) {
log.debug("merging Person instance");
try {
Person result = (Person) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Person instance) {
log.debug("attaching dirty Person instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Person instance) {
log.debug("attaching clean Person instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public List<Long> count() {
log.debug("count Person");
try {
String queryString = "SELECT COUNT(*) FROM Person";
HibernateTemplate ht = this.getHibernateTemplate();
List<Long> list = ht.find(queryString);
ht.setCacheQueries(true);
return list;
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public static PersonDAO getFromApplicationContext(ApplicationContext ctx) {
return (PersonDAO) ctx.getBean("PersonDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
ssh.zip_SSH 数据分页_ssh分页实现
共146个文件
jar:93个
xml:14个
class:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 68 浏览量
2022-09-23
02:10:35
上传
评论
收藏 33.88MB ZIP 举报
温馨提示
从数据库中获取数据,并且分页显示,页面用jstl+el表达式实现数据的显示
资源推荐
资源详情
资源评论
收起资源包目录
ssh.zip_SSH 数据分页_ssh分页实现 (146个子文件)
PersonDAO.class 7KB
UsersDAO.class 5KB
PageAction.class 2KB
PageServiceImpl.class 2KB
Person.class 1KB
UsersServiceImpl.class 1KB
Users.class 1KB
LoginAction.class 1KB
PageService.class 305B
UsersService.class 179B
.classpath 2KB
org.eclipse.wst.common.component 483B
org.eclipse.wst.jsdt.ui.superType.container 49B
com.springsource.org.jruby-1.4.0.jar 8.12MB
com.springsource.org.codehaus.groovy-1.6.5.jar 3.78MB
hibernate3.jar 2.21MB
struts2-dojo-plugin-2.2.1.jar 1.65MB
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar 1.57MB
xwork-core-2.2.1.jar 997KB
xerces-2.6.2.jar 987KB
mysql-connector-java-5.1.37.jar 963KB
freemarker-2.3.16.jar 860KB
struts2-core-2.2.1.jar 755KB
struts2-embeddedjsp-plugin-2.2.1.jar 662KB
org.springframework.context-3.0.5.RELEASE.jar 653KB
com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar 603KB
commons-collections-3.2.jar 558KB
org.springframework.beans-3.0.5.RELEASE.jar 542KB
javassist-3.7.ga.jar 531KB
javassist.jar 460KB
com.springsource.org.quartz-1.6.2.jar 440KB
antlr-2.7.6.jar 433KB
org.springframework.web.servlet-3.0.5.RELEASE.jar 409KB
com.springsource.org.apache.log4j-1.2.15.jar 387KB
org.springframework.web-3.0.5.RELEASE.jar 386KB
jstl-impl.jar 379KB
org.springframework.jdbc-3.0.5.RELEASE.jar 377KB
com.springsource.com.ibatis-2.3.4.726.jar 377KB
org.springframework.core-3.0.5.RELEASE.jar 373KB
jmxri.jar 357KB
log4j-1.2.11.jar 342KB
org.springframework.orm-3.0.5.RELEASE.jar 326KB
com.springsource.edu.emory.mathcs.backport-3.0.0.jar 324KB
com.springsource.net.sf.cglib-2.2.0.jar 319KB
org.springframework.aop-3.0.5.RELEASE.jar 314KB
dom4j-1.6.1.jar 307KB
com.springsource.org.apache.commons.httpclient-3.1.0.jar 301KB
com.springsource.bsh-2.0.0.b4.jar 279KB
cglib-2.1.3.jar 276KB
hibernate-annotations.jar 274KB
com.springsource.org.codehaus.jackson.mapper-1.0.0.jar 264KB
com.springsource.org.apache.commons.lang-2.4.0.jar 258KB
commons-lang-2.3.jar 240KB
org.springframework.transaction-3.0.5.RELEASE.jar 226KB
ognl-3.0.jar 224KB
jaxen-1.1-beta-7.jar 222KB
ehcache-1.2.3.jar 203KB
jmxremote_optional.jar 202KB
commons-beanutils-1.7.0.jar 184KB
jmxremote.jar 172KB
commons-collections-2.1.1.jar 171KB
org.springframework.web.portlet-3.0.5.RELEASE.jar 171KB
org.springframework.expression-3.0.5.RELEASE.jar 166KB
jamon-2.7.jar 147KB
commons-digester-2.0.jar 145KB
commons-validator-1.3.1.jar 136KB
json-lib-2.1-jdk15.jar 122KB
jotm.jar 121KB
xml-apis.jar 121KB
commons-dbcp.jar 119KB
hibernate-entitymanager.jar 116KB
jaas.jar 102KB
org.springframework.context.support-3.0.5.RELEASE.jar 99KB
com.springsource.org.apache.commons.pool-1.5.3.jar 95KB
xapool.jar 90KB
commons-chain-1.2.jar 90KB
commons-io-1.3.2.jar 86KB
persistence.jar 69KB
hibernate-commons-annotations.jar 65KB
struts2-convention-plugin-2.2.1.jar 64KB
oro-2.0.8.jar 64KB
com.springsource.org.apache.commons.logging-1.1.1.jar 60KB
org.springframework.oxm-3.0.5.RELEASE.jar 60KB
hibernate-validator.jar 60KB
commons-fileupload-1.2.1.jar 56KB
struts2-json-plugin-2.2.1.jar 55KB
com.springsource.org.apache.commons.fileupload-1.2.0.jar 53KB
org.springframework.asm-3.0.5.RELEASE.jar 52KB
ejb3-persistence.jar 52KB
javax.servlet.jsp.jstl.jar 44KB
commons-logging-api-1.1.jar 44KB
commons-logging-1.0.4.jar 37KB
classworlds-1.1.jar 37KB
org.springframework.aspects-3.0.5.RELEASE.jar 35KB
org.springframework.web.struts-3.0.5.RELEASE.jar 31KB
asm.jar 26KB
sslext-1.2-0.jar 26KB
struts2-spring-plugin-2.2.1.jar 21KB
asm-attrs.jar 16KB
jboss-archive-browsing.jar 12KB
共 146 条
- 1
- 2
资源评论
林当时
- 粉丝: 95
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功