Spring annotation configuration Transaction Management-problems, spring annotation configuration transactions

Source: Internet
Author: User

Spring annotation configuration Transaction Management-problems, spring annotation configuration transactions

Configure in the context:

<! -- Configure the annotation-driven Spring MVC controller programming model. --> <Bean id = "transactionManager" class = "org. springframework. orm. hibernate4.HibernateTransactionManager "> <property name =" sessionFactory "ref =" sessionFactory "/> </bean> <tx: annotation-driven transaction-manager =" transactionManager "/>

Note:

1. If the configuration is complete, an error is returned --

java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getConnectionProvider()....
Solution --
You're using Spring 3.2.5, and it's not compatible with the latest Hibernate 4.3.3 version that you're using. Hibernate 4.3 indeed decided to change the package of ConnectionProviderReturned SessionFactoryImplementor.getConnectionProvider(). Use the latest Spring version, or use Hibernate 4.2, and it shocould run better.

(

For example:

You use Spring 3.2.5, which is not in line with the latest Hibernate 4.3.3 version. Hibernate 4.3 does decide to change the ConnectionProvider SessionFactoryImplementor. getConnectionProvider () returned by the package (). Use the latest spring version, or use Hibernate 4.2, it should be better run.

)

2. If Spring transaction management is not configured for your project, the error is --

org.hibernate.HibernateException: No Session found for current thread

3. Error --

org.hibernate.HibernateException: No Session found for current thread
Solution --

Check whether you have added the @ Transactional annotation to the class that processes the business.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.