我试验了一下,确实如你所说,在同一个Transaction Context下,连续执行对同一个表的更新是不会引发“无限等待的”,所以我所说的那种问题应该是不存在的,而且手动的去写数据恢复代码的确是有够笨的:$(看来我得恶补一下Oracle常识了:))
我们的程序之所以出现“死锁”,估计是别的问题引起的,看来只有仔细调查后才知道原因了。
非常感谢你不厌其烦的解答,至少让我明白了JTA/JTS的基本原理。谢谢!
我试验了一下,确实如你所说,在同一个Transaction Context下,连续执行对同一个表的更新是不会引发“无限等待的”,所以我所说的那种问题应该是不存在的,而且手动的去写数据恢复代码的确是有够笨的:$(看来我得恶补一下Oracle常识了:))
我们的程序之所以出现“死锁”,估计是别的问题引起的,看来只有仔细调查后才知道原因了。
非常感谢你不厌其烦的解答,至少让我明白了JTA/JTS的基本原理。谢谢!
从何地方得知我是金蝶的?好生奇怪!
:)
另外小声问一句:金蝶是什么东西呀?:-) :(
正常情况下,一般程序在UT中产生异常就应该导致transaction的回滚,而嵌套的transaction中内层的transaction是会检查是否有外层的transaction而不会在你程序指定commit的地方进行commit,直到最外层的transaction被提交,所以前面讨论的autoCommit(true)的情况大可不必担心。
autoCommit(true);
doA();
的等价代码等于:
startUT();();//这句话会被manager忽略因为外层的T
doA();
commitUT();//这句话会被manager忽略因为外层的T
如果想测试这种情况,可以用些ide进入调试模式,编写一些特殊代码试试看。
我在这里顺便提点小建议:希望大家在讨论问题的时候注意用词不要对公司或者个人进行攻击。
and my program alawys update the record 1 data in database ,but all is under the transaction.
when you have many transaction is open and want update the same record 1 ,the dead lock state will be throws in your program.
(because have thread want use the a resource. maybe you can use syschronization to solve it.)
that is my last time state lah.
so i change my database this table to not innodb support,and then i not get the dead lock again in this program again.
so that i think your problem is same with me .
hope can help you.
and i feel very sorry cos my english is very poor ,maybe your cant understand what i mean.
In a stateful session bean with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls. Even if each business method called by the client opens and closes the database connection, the association is retained until the instance completes the transaction.
In a stateful session bean with a JDBC transaction, the JDBC connection retains the association between the bean instance and the transaction across multiple calls. If the connection is closed, the association is not retained.