[英]How to configure an eclipselink JTA sequence connection pool
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. 我在MySQL上遇到了TABLE序列的并发问题,发现建议解决方案可能是为序列生成配置一个单独的连接池。 In this stackoverflow question it points to the Eclipselink Documentation which has a section for an example that's empty.
在这个stackoverflow问题中,它指向Eclipselink文档 ,其中有一个示例部分为空。 I can't seem to find any example of how this is configured.
我似乎找不到任何有关此配置方式的示例。
My persistence.xml at the moment is below. 目前,我的persistence.xml在下面。 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. 除了等待死锁是否停止之外,知道我应该寻找什么来确定它是否正常也很高兴。
Many thanks 非常感谢
<?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>
Try also giving a non-jta-data-source, 还尝试提供非jta数据源,
<non-jta-data-source>jdbc/myapp/nonjta</non-jta-data-source>
You will need to create the DataSource in your application server as non-JTA. 您将需要在应用程序服务器中将数据源创建为非JTA。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.