package com.softeem.hibernate.pojo;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
/**
* A data access object (DAO) providing persistence and search support for Login
* 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.softeem.hibernate.pojo.Login
* @author MyEclipse Persistence Tools
*/
public class LoginDAO extends BaseHibernateDAO {
private static final Log log = LogFactory.getLog(LoginDAO.class);
// property constants
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
public void save(Login transientInstance) {
log.debug("saving Login instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Login persistentInstance) {
log.debug("deleting Login instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Login findById(java.lang.Integer id) {
log.debug("getting Login instance with id: " + id);
try {
Login instance = (Login) getSession().get(
"com.softeem.hibernate.pojo.Login", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Login instance) {
log.debug("finding Login instance by example");
try {
List results = getSession().createCriteria(
"com.softeem.hibernate.pojo.Login").add(
Example.create(instance)).list();
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 Login instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Login as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} 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 Login instances");
try {
String queryString = "from Login";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Login merge(Login detachedInstance) {
log.debug("merging Login instance");
try {
Login result = (Login) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Login instance) {
log.debug("attaching dirty Login instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Login instance) {
log.debug("attaching clean Login instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JSF+hibernate实现批量删除
共37个文件
jar:9个
java:8个
class:8个
3星 · 超过75%的资源 需积分: 10 35 下载量 13 浏览量
2008-09-23
02:13:37
上传
评论
收藏 1.97MB RAR 举报
温馨提示
JSF+hibernate实现批量删除,CRUD
资源推荐
资源详情
资源评论
收起资源包目录
JSFUserSystem.rar (37个子文件)
src
com
softeem
jsf
bean
UserBean.java 1KB
UserService.java 1KB
hibernate
pojo
AbstractLogin.java 1KB
IBaseHibernateDAO.java 237B
Login.java 500B
BaseHibernateDAO.java 386B
LoginDAO.java 4KB
Login.hbm.xml 831B
session
HibernateSessionFactory.java 3KB
hibernate.cfg.xml 983B
WebRoot
META-INF
MANIFEST.MF 39B
edit.jsp 1KB
list.jsp 2KB
add.jsp 1KB
index.jsp 615B
WEB-INF
classes
com
softeem
jsf
bean
UserBean.class 3KB
UserService.class 2KB
hibernate
pojo
AbstractLogin.class 2KB
BaseHibernateDAO.class 549B
LoginDAO.class 5KB
Login.hbm.xml 831B
Login.class 727B
IBaseHibernateDAO.class 191B
session
HibernateSessionFactory.class 2KB
hibernate.cfg.xml 983B
faces-config.xml 2KB
lib
msbase.jar 294KB
mssqlserver.jar 67KB
commons-pool-1.2.jar 41KB
jstl.jar 20KB
standard.jar 384KB
mysql-connector-java-5.1.6-bin.jar 687KB
commons-collections-3.1.jar 546KB
msutil.jar 63KB
commons-dbcp-1.2.1.jar 105KB
.faces-config.mex 2KB
web.xml 841B
共 37 条
- 1
资源评论
- 程序视界85072013-06-13功能比较简单还可以
zhangyulei21
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功