In JBoss/WildFly should I enable JTA on data source to use with JPA?

后端 未结 3 929
悲哀的现实
悲哀的现实 2021-01-06 07:05

In JBoss/WildFly, when configuring a data source, there is a JTA option, which is disabled by default:



        
3条回答
  •  长情又很酷
    2021-01-06 07:43

    I've just experienced a problem related to this issue.

    I was running a container managed transaction involving approximately 20,000 inserts into a MySQL database.

    The transaction failed randomly, sometimes after around 3,500 inserts, other times after around 6,000 inserts, etc.

    After investigation I found that the JTA option on the WildFly datasource definition was set to false.

    Changing this setting to true fixed the problem, so I would agree with @user3472929 that JTA should be set to true in the datasource definition unless you have some specific reason not to.

提交回复
热议问题