Parse the error principle and resolve Hibernate no transactionmanagerlookup specified! Error

Source: Internet
Author: User

A, No transactionmanagerlookup specified! The general meaning is: There is no transaction management finder specified! Second, let's have a little interest in hibernate transaction processing!

(1) Hibernate is a lightweight object encapsulation of JDBC, hibernate itself does not have the transaction processing function, Hibernate's transaction is actually the underlying JDBC Transaction encapsulation (Local transaction: Simple database only one), or JTA transaction package (all transactions: Simply say that the database has multiple);

(2) Following our detailed analysis:
The 1.Hibernate can be configured as Jdbctransaction or Jtatransaction, depending on your configuration in hibernate.properties:

[HTML]View PlainCopy
    1. * If you are using a local transaction (JDBC Transaction)
    2. < name="Hibernate.current_session_context_class">thread</ Property >
    3. * If you are using a global transaction (JTA Transaction)
    4. < name="Hibernate.current_session_context_class">jta</Property >
2. If you do not configure anything, use jdbctransaction! by default Whether you're going to let hibernate use Jdbctransaction or jtatransaction!

Third, problem solving

(1) This reminds us of the way we use hibernate to handle transactions, one of which is opensession () and Getcurrentsession ()

(2) The method owner who needs the above configuration is getcurrentsession ()! OK the cause of the problem to find! Change your opensession () to Getcurrentsession ()!

If you want to know more about the opensession () and Getcurrentsession () methods, visit: http://blog.csdn.net/xlgen157387/article/details/39777827

NOTE: Reprint please indicate the source!!

Parse the error principle and resolve Hibernate no transactionmanagerlookup specified! Error

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.