我目前正在使用Spring和Hibernate設置一個項目。經過幾個其他問題,我得到了下一個問題:PHibernate + Spring:javax.persistence.TransactionRequiredException:沒有事務正在進行
無論如何。當致電entityManager.flush()
我收到一個例外:javax.persistence.TransactionRequiredException: no transaction is in progress
。
我已經用@Transactional
註釋了我的課,但它仍然無法正常工作。
我在這裏讀取serval線程,其中人們遇到類似問題,但解決方案始終爲<tx:annotation-driven transaction-manager="transactionManager" />
。但我已經有了這個配置。
我不知道什麼樣的代碼或文件,我應該提供你,所以你可以在這裏找到整個項目: https://drive.google.com/file/d/0B7Exc4dHICl-UDN3ZEJnbS1FZFk/edit?usp=sharing
預先感謝您。