休眠> 3.3 和c3p0

发布于 2024-10-04 23:11:56 字数 403 浏览 1 评论 0原文

由于 c3p0 似乎不再与 Hibernate 捆绑在一起(从版本 > 3.3 开始,我使用 Hibernate 3.6.0),我想知道如何将 c3p0 与 Hibernate 集成。

显然,旧的方法

<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

似乎不再适用,因为 Hibernate 不再提供 C3P0ConnectionProvider 类。我现在必须自己构建它还是集成 hibernate-c3p0-3.3.x.jar 是否安全?

注意:我使用的是裸 Hibernate,没有 Spring 等。

As c3p0 does not seem to be bundled with Hibernate anymore (as of versions > 3.3, I am using Hibernate 3.6.0), I'd like to know how to integrate c3p0 with Hibernate.

Obviously the old approach with

<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

does not seem to work anymore, as the class C3P0ConnectionProvider is not provided by Hibernate anymore. Do I now have to build this on my own or is it safe to integrate the hibernate-c3p0-3.3.x.jar?

Note: I am using bare Hibernate, no Spring etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十级心震 2024-10-11 23:11:56

我在 hibernate.cfg.xml 中使用以下内容:

<!-- c3p0 config http://www.hibernate.org/214.html -->
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>        
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">60</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">2</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.timeout">0</property>
<property name="hibernate.c3p0.acquireRetryAttempts">1</property>
<property name="hibernate.c3p0.acquireRetryDelay">250</property>

我使用最新的 hibernate(当前为 3.6.0 GA),并且我已将其包含在类路径中 c3p0-0.9.1.2.jar(当前最新)。一切都按预期进行。

I use the following in hibernate.cfg.xml:

<!-- c3p0 config http://www.hibernate.org/214.html -->
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>        
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">60</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">2</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.timeout">0</property>
<property name="hibernate.c3p0.acquireRetryAttempts">1</property>
<property name="hibernate.c3p0.acquireRetryDelay">250</property>

I use the latest hibernate (currently 3.6.0 GA) and I've included in the classpath c3p0-0.9.1.2.jar (currently latest). Everything works as expected.

幻想少年梦 2024-10-11 23:11:56

也许你需要 hibernate-c3po-3..jar

<!-- Hibernate c3p0 connection pool -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>3.6.3.Final</version>
</dependency>

perhaps you need hibernate-c3po-3..jar

<!-- Hibernate c3p0 connection pool -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>3.6.3.Final</version>
</dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文