Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TopLink与JPA建立更多连接_Jpa_Connection_Toplink - Fatal编程技术网

TopLink与JPA建立更多连接

TopLink与JPA建立更多连接,jpa,connection,toplink,Jpa,Connection,Toplink,在我的应用程序中,我们将Toplink与Jpa一起使用。 这里的问题是我们在这个应用程序中使用存储过程,我们使用Jndi连接进行存储过程调用,我们使用EntityManger进行其余查询。但在这里,如果我们启动应用程序,它将从连接池中获取两个连接。应用程序启动后,我调用存储过程resp 一个sp我正在使用一个连接,但在websphere连接池中它正在创建两个连接? 你能帮我解决这个问题吗 我不会使用JTA来获得我正在使用的JDBC连接 EntityManager em=getJpaTemplat

在我的应用程序中,我们将Toplink与Jpa一起使用。 这里的问题是我们在这个应用程序中使用存储过程,我们使用Jndi连接进行存储过程调用,我们使用EntityManger进行其余查询。但在这里,如果我们启动应用程序,它将从连接池中获取两个连接。应用程序启动后,我调用存储过程resp 一个sp我正在使用一个连接,但在websphere连接池中它正在创建两个连接? 你能帮我解决这个问题吗

我不会使用JTA来获得我正在使用的JDBC连接

EntityManager em=getJpaTemplate.GetEntityManager工厂.createEntityManager

通过这种方式,我获得了JDBC连接…我配置了persitence.xml文件,代码如下

<properties>
    <property name="toplink.logging.level" value="OFF"/>
    <property name="toplink.cache.type.default" value="NONE"/>
    <property name="com.thoughtinc.runtime.persistence.sql.syntax" value="db2" />
</properties>

所以,如果我在这里做错了什么,请检查一下,并告诉我任何错误。

您使用的是JTA还是非JTA?您是否在使用池后将连接释放回池

根据您的配置,包括persistence.xml,如果您配置了非JTA登录名,TopLink可以将其用于非事务性读取查询。这在persistence.xml中是可配置的


要从TopLink EclipseLink EntityManager获取JDBC连接,请使用em.unwapconnection.class

嗨,詹姆斯,谢谢你的回复。我不会使用JTA来获取JDBC连接,我使用的是EntityManager em=getJpaTemplate.GetEntityManager工厂.createEntityManager;通过这种方式,我获得了JDBC连接…我配置了persitence.xml文件,代码如下。。。所以,如果我在这里做错了什么,请仔细调查并告诉我。