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.  [ 2 posts ] 
Author Message
 Post subject: Configuration of hibernate
PostPosted: Fri Dec 08, 2006 5:42 am 
Newbie

Joined: Tue Dec 05, 2006 8:59 am
Posts: 8
Hibernate version: 3.1rc2

Name and version of the database you are using: mysql 5


Hi, I'm currently migrating an application. This application used c3p0 to manage pooling. I try to implement hibernate but I don't find the equivalence between our precedent parameters and those we can use in hibernate.xml


Code:
      
// Config is a com.mchange.v2.c3p0.PoolConfig;

config.setInitialPoolSize(3);   // 3 is the default for c3p0 anyway 
         // if > MaxPoolSize, it will be ignored - no worry
         // (as said in c3p0 docs, it's only a suggestion
         // how many connections to acquire to start with)

         config.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
         config.setAcquireRetryDelay(500);  // 500 miliseconds wait before try to acquire connection again
         config.setCheckoutTimeout(0);      // 0 = wait indefinitely for new connection
         config.setAutomaticTestTable("connection_test_table"); 
         config.setTestConnectionOnCheckin(true); //
         config.setIdleConnectionTestPeriod(60); // test idle connection every 60 sec
         config.setMaxStatementsPerConnection(100);
         config.setMaxIdleTime(0); // 0 = idle connections never expire
         config.setBreakAfterAcquireFailure(false);  // never fail if any way possible



In hibernate.xml, I write this :

Code:
  <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.c3p0.min_size">1</property>
        <property name="hibernate.c3p0.max_size">20</property>
        <property name="hibernate.c3p0.acquire_increment">5</property>
        <property name="hibernate.c3p0.autocommit">false</property>
        <property name="hibernate.c3p0.max_statements">100</property>
        <property name="hibernate.c3p0.timeout">0</property>       
        <!-- Test connection every 60 s -->
        <property name="hibernate.c3p0.idle_test_period">60</property>       
       
        <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>       
        <!-- Show sql request -->       
        <property name="hibernate.show_sql">true</property>       


I didn't found :

Code:
         config.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
         config.setAcquireRetryDelay(500);  // 500 miliseconds wait before try to acquire connection again
         config.setAutomaticTestTable("connection_test_table");  // very very fast test, don't worry
         config.setTestConnectionOnCheckin(true); // this will *not* make l2j slower in any way
         config.setMaxIdleTime(0); // 0 = idle connections never expire
         config.setBreakAfterAcquireFailure(false);  // never fail if any way possible


ps : you can tell me if you find those parameters unusefull.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 12:27 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
You can specify any c3p0 properties you want by creating a c3p0.properties file as explained here: http://www.hibernate.org/214.html

That page also links to a page with the complete listing of parameters: http://www.mchange.com/projects/c3p0/index.html#appendix_a

_________________
nathan


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