Java and Spring. Transactional annotation @Transactional

后端 未结 3 884
不知归路
不知归路 2021-01-29 03:39

I want to Remove begin and commit transactions from DAO class , and I need to use Transactional annotation. How it should be done? Now , exception is org.hibernate.HibernateE

3条回答
  •  别那么骄傲
    2021-01-29 04:05

    After setting a correct transaction manager, just tried to move the @Transactional annotation to the method on the implemented class

        @Repository
        public class CoursesDAOImpl implements CoursesDAO {
    
        @Autowired
        private SessionFactory sessionFactory;
    
        @Transactional 
    public Course createCourse(Course course) {
    

提交回复
热议问题