ITeye博客

就是因为一个注解 就一个上午

tonytony3 · 2011-11-04 13:17 · spring security 3.1 hibernate getSession sessionFactory.getCurrentSession · 行业应用 · Markdown

@Transactional public class BaseDaoImpl implements BaseDao { protected Logger log = LoggerFactory.getLogger(getClass());

// HibernateTemplate

protected SessionFactory sessionFactory;

@Resource
public void setSessionFactory(SessionFactory sessionFactory) {
	System.out.println("the set sesionF");
	this.sessionFactory = sessionFactory;
}

否则,是出:No Hibernate Session bound to thread, and configuration does not allow create of non-transactional one here

只是现在还是不太明白, 为什么 事务要在DAO上 配,不是SERVICE层吗?

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。