- 浏览: 20762 次
- 性别:
- 来自: 沈阳
最新评论
文章列表
BeanUtils.setProperty 应用
- 博客分类:
- java
BeanUtils.setProperty 简单用法
public void getOverTime() throws Exception{
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
Query query = session.createSQLQuery("select distinct(workid) workid from work");
List<BigInteger> list = query.list ...
1. getHibernateTemplate().getSessionFactory().createSQLQuery(insersql).executeUpdate() 直接写 sql 语句进行数据存储。
2. getHibernateTemplate().find(hql); 进行查询
public List findAll() throws Exception {
log.debug("finding all User instances");
try {
String queryString = "from User" ...
多的一方 xml 配置
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclip ...
spring 事物配置
- 博客分类:
- spring
private UserDAO userDAO;
public void setUserDAO(UserDAO userDAO) {
this.userDAO = userDAO;
}
/**
* 异常只有抛出事物才有回滚机制
*/
public void saveUser(User user) throws Exception{
userDAO.save(user);
}
public void save(User transientInstance) throws Exception {
log.debug(" ...