-->
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: hibernate-search support connection pool?
PostPosted: Sun Dec 12, 2010 10:54 pm 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
Hi:
I am using the hibernate-search 3.2.1,everything went well until this morning.

Since my application is now to be tested,so the app was started yesterday afternoon,it works well at first. But when I check it this morning,I got some exceptions:

Quote:
org.hibernate.exception.JDBCConnectionException:could not execute query.
caused by :com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:communications link failure
The last packet successfully reveived from the server was 76279756 milliseconds ago.


After googling it,it is said that this is caused by the mysql connection pool.(the connection has been closed when it is checked out from the pool).

And in my hibernate.cfg.xml,I intended to use the c3p0,so this is the fragment:

Code:
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>


But I am surprised when I check the hibernate-core-3.5.4.jar,there is no "C3P0ConnectionProvider" under the package:"org.hibernate.connection", also,in the log of my application,I have not found any c3p0 words.so I am confused:

1> Does the hibernate-search support connection pool? If so,is it mean I have add the ConnectionProvider manually?

2> If support,how to config the c3p0?
I know the basic config(in the above exmaple),but how about if I want to add some other c3p0 config properties? In my requirement,I need the following two properties:
Code:
c3p0.testConnectionsOnCheckIn=ture  //validate the connection when check in
c3p0.idleConnectionTestPeriod=3600 // check every 1 hour.


Top
 Profile  
 
 Post subject: Re: hibernate-search support connection pool?
PostPosted: Mon Dec 13, 2010 5:48 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Quote:
1> Does the hibernate-search support connection pool? If so,is it mean I have add the ConnectionProvider manually?

Hibernate Search supports connection pooling, because it relies on Core which provides pooling. And yes you have to add the connection pool provider yourself. Connection pooling is a pluggable extension where you for example can chose between c3p0 and proxool. If you want to use the c3p0 you need to add the right dependency - https://repository.jboss.org/nexus/cont ... rnate-c3p0

Quote:
2> If support,how to config the c3p0?

The configuration is via the properties you have in your configuration file. That should be fine.


Top
 Profile  
 
 Post subject: Re: hibernate-search support connection pool?
PostPosted: Mon Dec 13, 2010 7:35 am 
Beginner
Beginner

Joined: Fri Nov 05, 2010 7:25 am
Posts: 21
hardy.ferentschik wrote:
Quote:
1> Does the hibernate-search support connection pool? If so,is it mean I have add the ConnectionProvider manually?

Hibernate Search supports connection pooling, because it relies on Core which provides pooling. And yes you have to add the connection pool provider yourself. Connection pooling is a pluggable extension where you for example can chose between c3p0 and proxool. If you want to use the c3p0 you need to add the right dependency - https://repository.jboss.org/nexus/cont ... rnate-c3p0
I am using hibernate-search 3.2.1,and the hibernate-core is 3.5.4. So the hibernate-c3p0 should be 3.5.4 also?
Quote:
2> If support,how to config the c3p0?

The configuration is via the properties you have in your configuration file. That should be fine.

You mean I do not need extra work? The config I list is all?

But how about if I want to make c3p0 validate the connection when a connection is called?

There is a property named "testbeforecheckin" in c3p0,but I did not found the accoring property like "hibernate.c3p0.testbeforecheckin"? Where to add it?

Since the connection will closed when it is not alive for 8 hours.


Top
 Profile  
 
 Post subject: Re: hibernate-search support connection pool?
PostPosted: Mon Dec 13, 2010 7:39 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
All properties prefixed with hibernate.c3p0 will be passed on to c3p0


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.