使用 Hibernate 从两个不同的 Web 应用程序 (GXT) 连接相同的数据库
我正在使用基于 GXT 构建的两个不同的 Web 应用程序。但问题是,两个应用程序都访问同一个数据库,而当我们尝试在 Apache Tomcat 中一起部署然后同时访问它们时,hibernate 不允许这样做。您能告诉我如何使用两个应用程序中的 hibernate 访问同一个数据库吗?我们为此使用 c3p0 连接池。
I am working with two different web applications built upon GXT. But the problem is that both the applications are accessing the same database and the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在哪里?你得到了什么错误?提供一些详细信息可能有助于获得答案。
就这样做吧,我在这里没有看到任何阻碍(这就是为什么回答上述问题会有所帮助)。在不同的 JVM 中实例化多个 SessionFactory 实际上是一种非常常见的场景(例如,在集群上运行单个应用程序时,这在技术上与您的场景等效)。
And what was the problem? What error did you get? Provide some details might help to get an answer.
Just do it, I don't see anything blocking here (which is why answering the mentioned questions will help). Instantiating several
SessionFactory
in different JVMs is actually a very common scenario (e.g. when running a single application on a cluster, which is technically equivalent to your scenario).