---
title: "就是因为一个注解 就一个上午"
author: "tonytony3"
date: "2011-11-04T13:17:10Z"
tags: []
categories: ["行业应用"]
slug: "untitled"
draft: false
lastmod: "2011-11-04T13:17:10Z"
id: 1235293
url: "https://tonytony3.iteye.com/blog/1235293"
---

<span style="color:red">@Transactional</span>
public class BaseDaoImpl<T extends Serializable> implements BaseDao<T> {
	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;
	}



否则，是出：<span style="color:red">No Hibernate Session bound to thread, and configuration does not allow create of non-transactional one here </span>


只是现在还是不太明白， 为什么 事务要在DAO上 配，不是SERVICE层吗？