Spring-Hibernate - No Session found for current thread

来源:互联网 发布:matlab处理大量数据 编辑:程序博客网 时间:2024/04/30 02:54

In your SpringBean.xml you should uncomment <tx:annotation-driven/>:

<tx:annotation-driven transaction-manager="transactionManager"/>

And then you should annotate the CustomerServiceImpl.saveCustomer method as @Transactional:

@Servicepublic class CustomerServiceImpl implements CustomerService {    ...    @Override    @Transactional    public void saveCustomer(Customer customer) {        customerDaoImpl.saveCustomer(customer);    }    ...}
0 0