如何配置eclipselink JTA序列连接池 [英] How to configure an eclipselink JTA sequence connection pool
问题描述
我在MySQL上遇到TABLE序列的并发问题,发现建议该解决方案可能正在配置一个单独的连接池以用于序列生成.在此stackoverflow问题指向 Eclipselink文档该示例的一个部分为空.我似乎找不到任何有关此配置的示例.
I have been having concurrency problems with TABLE sequences on MySQL and found advise that the solution may be configuring a separate connection pool for sequence generation. In this stackoverflow question it points to the Eclipselink Documentation which has a section for an example that's empty. I can't seem to find any example of how this is configured.
此刻我的persistence.xml在下面.我应该进行哪些更改以确保在单独的事务/连接池上执行序列生成.
My persistence.xml at the moment is below. What should I change to ensure sequence generation is executed on a seperate transaction / connection pool.
除了等待死锁是否停止发生之外,知道我应该寻找什么来确定它是否正常也很高兴.
It would also be great to know what I should look for to determine it's working, other than just waiting to see if deadlocks stop occurring.
非常感谢
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="myapp">
<jta-data-source>jdbc/myapp</jta-data-source>
<non-jta-data-source>jdbc/myapp/nonjta</non-jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="MySQL"/>
<property name="javax.persistence.validation.mode" value="NONE" />
<property name="eclipselink.jdbc.sequence-connection-pool.non-jta-data-source" value="jdbc/rightcab/nonjta" />
</properties>
</persistence-unit>
</persistence>
推荐答案
还尝试提供非jta数据源,
Try also giving a non-jta-data-source,
<non-jta-data-source>jdbc/myapp/nonjta</non-jta-data-source>
您将需要在应用程序服务器中将数据源创建为非JTA.
You will need to create the DataSource in your application server as non-JTA.
这篇关于如何配置eclipselink JTA序列连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!