Problems that cannot be submitted due to automatic rollback of proxool + hibernate + spring current affairs

Source: Internet
Author: User

This problem caused me to spend almost one afternoon .....

 

The project needs to use dual data sources. For the connection pool, I chose the well-received proxool. As a result, I configured two data sources in spring and found no errors during transaction testing, data cannot be submitted either ..... This made me wonder for a long time... I always thought that the dual data source configuration was wrong, because it was the first time to configure the dual data source in the case of SSH + proxool .....

 

Later, I tested it gradually until I configured the dual data source and found that it could not be inserted. So I began to suspect that it was a database problem... The result is no. Later I was wondering, is my proxool configuration corrupted? Think about it, isn't it that bad ~~

 

Then, restore the original configuration and find that the data source of proxool cannot be inserted, but the data can be queried and changed to JDBC. It seems that this is a problem with proxool... Find the root cause and immediately remedy the problem .... However, I cannot find a satisfactory answer on the Internet, or I just can't find it. In addition, I still use the proxool data source .... It seems that proxool itself has many problems...

 

Test again to see why there is a problem with the data of proxool. During the switch between proxool and JDBC, it is found that the value of the Self-increasing primary key is not consecutive and it is suspected that proxool did not submit a query, instead, it automatically rolls back ...., turn on SQL event detector tracking...

It is automatically rolled back .....

As follows:

Set implicit_transactions on
Go
Declare @ P1 int
Set @ p1 = 1
Exec sp_prepare @ P1 output, n' @ P0 nvarchar (4000), @ P1 nvarchar (4000) ', n' insert into testdatabase. DBO. users (name, deptcode) values (@ P0, @ P1) Select scope_identity () as ID ', 1
Select @ p1
Go
Exec sp_execute 1, n 'kk ', null
Go
If @ trancount> 0 rollback tran
Go
If @ trancount> 0 commit tran
Set implicit_transactions off
Go

 

This is really depressing .... There are also problems like proxool. I have checked the relevant information and found that few people have encountered this problem. Only one person said they have discovered this problem, you only need to use hibernate to load the proxool configuration file... I use spring to control the hibernate parameters. The parameters are configured with hibernate to load the proxool file ......

 

So the hibernate. Connection. autocommit parameter is used and set to true.

Test again .. The problem is solved ..... So far it has come to an end... Although proxool has a good reputation, so far, I have found many bugs of this guy .... So far, we have met many people, and many of them are well known... Today, this is one of the major bugs ....

 

I wrote a solution to the same problem, because I did not find a solution on the Internet ....

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.