-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: C3P0 - Not used by Hibernate although present in config file
PostPosted: Fri Aug 14, 2009 8:18 am 
Newbie

Joined: Fri Aug 14, 2009 8:06 am
Posts: 19
Hi,

I am using Eclipse 3.5 together with Hibernate 3.3.2 and c3p0 0.9.1 together with javadb 10.5.1.1 on Mac OS X 10.5.8.

I wanted to start using the c3p0 connection pooling and read in the user manual that Hibernate should automatically use it when specifying c3p0 properties in the configuration file. However, even though I did just that I still get the message that Hibernate is using the default build in connection pool.

I tried with and without prepending hibernate. before the c3p0 properties but to no avail.

This is my configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url">jdbc:derby:/test;create=true</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.current_session_context_class">org.hibernate.context.JTASessionContext</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.max_size">50</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>
</session-factory>
</hibernate-configuration>

This is the message I get from Hibernate:
INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)

The configuration file is read correctly as can be deduced from the following log messages:

81 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
167 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
168 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
169 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
191 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver
191 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.url=jdbc:derby:/test;create=true
191 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.username=user
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.dialect=org.hibernate.dialect.DerbyDialect
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.current_session_context_class=org.hibernate.context.JTASessionContext
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.acquire_increment=5
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.idle_test_period=100
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.min_size=10
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.max_size=50
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.timeout=1800
192 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.max_statements=50
192 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null

The c3p0 jar is on the classpath of my eclipse project.

I've been browsing through the posts and have been googling on internet but did not find an answer to my problem. I'm pretty new to Hibernate so I guess I'm overlooking something obvious.

Any help will be appreciated.

Kind regards,
Stef Kuypers


Top
 Profile  
 
 Post subject: Re: C3P0 - Not used by Hibernate although present in config file
PostPosted: Tue Aug 25, 2009 11:20 pm 
Newbie

Joined: Tue Aug 25, 2009 11:17 pm
Posts: 1
Try setting the following in your hibernate.cfg.xml:

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


Top
 Profile  
 
 Post subject: Re: C3P0 - Not used by Hibernate although present in config file
PostPosted: Wed Aug 26, 2009 10:37 am 
Newbie

Joined: Fri Jan 11, 2008 5:50 am
Posts: 9
The provider_class property is a new property that must be set when using Hibernate 3.

This is also mentioned here


Top
 Profile  
 
 Post subject: Re: C3P0 - Not used by Hibernate although present in config file
PostPosted: Thu Aug 27, 2009 6:21 am 
Newbie

Joined: Fri Aug 14, 2009 8:06 am
Posts: 19
Thanks! This works!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.