[英]Connecting the same database from two different web applications(GXT) using Hibernate
I am working with two different web applications built upon GXT. 我正在使用基于GXT构建的两个不同的Web应用程序。 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. 但是问题在于,当我们尝试在Apache Tomcat中一起部署然后同时访问它们时,两个应用程序都在访问同一个数据库,并且休眠状态不允许这样做。 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. 我们为此使用c3p0连接池。
(...) Hibernate is not allowing to do so when we tried to deploy together in Apache Tomcat and then access them simultaneously. (...)当我们尝试在Apache Tomcat中一起部署然后同时访问它们时,Hibernate不允许这样做。
And what was the problem? 那是什么问题呢? What error did you get? 您遇到什么错误? Provide some details might help to get an answer. 提供一些详细信息可能有助于获得答案。
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. 我们为此使用c3p0连接池。
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 (eg when running a single application on a cluster, which is technically equivalent to your scenario). 实际上,在不同的JVM中实例化几个SessionFactory
是一个非常常见的场景(例如,在集群上运行单个应用程序时,从技术上讲,这等效于您的场景)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.