-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate C3P0
PostPosted: Tue May 18, 2010 11:13 am 
Beginner
Beginner

Joined: Mon May 10, 2010 2:00 pm
Posts: 22
I am having problems trying to implement C3P0 connection pooling in my app. I am using the Netbeans IDE 6.8. My app includes Spring Framework and Spring Web MVC 2.5 and Hibernate (not sure which version, but it is part of the 2.x family - built into Netbeans Platform options).

The error is a noClassDefinition error for my HibernateUtil class. When I remove the C3P0 properties from my hibernate configuration file the error clears up and the site runs.

Here is what my configuration file looks like:
Code:
<?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.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@xxx.xxx.xxx.xxx:xxxx:********</property>
    <property name="hibernate.default_schema">********</property>
    <property name="hibernate.connection.username">********</property>
    <property name="hibernate.connection.password">********</property>
    <property name="hibernate.jdbc.batch_size">20</property>
    <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
    <property name="hibernate.c3p0.acquire_increment">1</property>
    <property name="hibernate.c3p0.max_size">200</property>
    <property name="hibernate.c3p0.min_size">10</property>
    <property name="hibernate.c3p0.max_statements">0</property>
    <property name="hibernate.c3p0.timeout">1800</property>
    <property name="hibernate.show_sql">true</property>

    <mapping resource="dwd/dao/entity/Person.hbm.xml"/>
    <mapping resource="dwd/dao/entity/Report.hbm.xml"/>
    <mapping resource="dwd/dao/entity/Project.hbm.xml"/>
  </session-factory>
</hibernate-configuration>



Top
 Profile  
 
 Post subject: Re: Hibernate C3P0
PostPosted: Tue May 18, 2010 11:19 am 
Regular
Regular

Joined: Tue May 11, 2010 5:50 pm
Posts: 54
Location: Norman, Ok, U.S.A
You will also need the C3P0 jar in your classpath


Top
 Profile  
 
 Post subject: Re: Hibernate C3P0
PostPosted: Tue May 18, 2010 1:13 pm 
Beginner
Beginner

Joined: Mon May 10, 2010 2:00 pm
Posts: 22
ivirani wrote:
You will also need the C3P0 jar in your classpath


From how I read the documentation, I had assumed that Hibernate included the C3P0 functionality. I thought it simply need to be specified in the configuration file.

I downloaded the c3p0 files from sourceforge and imported the 3 c3p0 jar files into the classpath of my project. Everything worked when I deployed it.

Hopefully this implementation will resolve the issues I have been having with the website.

Thank you.


Top
 Profile  
 
 Post subject: Re: Hibernate C3P0
PostPosted: Tue May 18, 2010 6:23 pm 
Regular
Regular

Joined: Tue May 11, 2010 5:50 pm
Posts: 54
Location: Norman, Ok, U.S.A
Please let us know if that solved the problem you have been having with your website


Top
 Profile  
 
 Post subject: Re: Hibernate C3P0
PostPosted: Fri Jun 04, 2010 8:53 am 
Beginner
Beginner

Joined: Mon May 10, 2010 2:00 pm
Posts: 22
ivirani wrote:
Please let us know if that solved the problem you have been having with your website


I've got C3P0 running in my app now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.