gpt4 book ai didi

java - 使用 Hibernate 从两个不同的 Web 应用程序 (GXT) 连接同一个数据库

转载 作者:行者123 更新时间:2023-11-30 11:57:33 25 4
gpt4 key购买 nike

我正在使用基于 GXT 构建的两个不同的 Web 应用程序。但问题是这两个应用程序都在访问同一个数据库,而当我们尝试在 Apache Tomcat 中一起部署然后同时访问它们时,hibernate 不允许这样做。你能告诉我我们如何从两个应用程序中使用 hibernate 访问同一个数据库吗?我们为此使用 c3p0 连接池。

最佳答案

(...) Hibernate is not allowing to do so when we tried to deploy together in Apache Tomcat and then access them simultaneously.

问题是什么?你得到了什么错误?提供一些细节可能有助于获得答案。

Can you tell me how can we access the same database using hibernate from both the applications? We are using c3p0 connection pool for this.

照做吧,我看不出有什么障碍(这就是为什么回答上述问题会有帮助)。在不同的 JVM 中实例化多个 SessionFactory 实际上是一种非常常见的场景(例如,在集群上运行 单个 应用程序时,这在技术上等同于您的场景)。

关于java - 使用 Hibernate 从两个不同的 Web 应用程序 (GXT) 连接同一个数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3741544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com