Hibernate: Config properties, c3p0 and disable the cache level

July 30th, 2009 by jeremychone
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/dbname?useUnicode=true&ampcharacterEncoding=UTF8
hibernate.connection.username=username
hibernate.connection.password=pwd

#only if you use the current session
hibernate.current_session_context_class=thread
hibernate.connection.release_mode=on_close

#disable the second level cache
hibernate.cache.use_second_level_cache=false
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

#do not forget the provider_class to set C3P0. No more auto detect in Hibernate 3.0.0+
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800

2 Responses to “Hibernate: Config properties, c3p0 and disable the cache level”

  1. Alex Miller Says:

    Don’t forget to add the c3p0 jars to your classpath, or it won’t be picked up.

  2. jeremychone Says:

    @Alex, yes good point. Silence can be miss-leading.

Leave a Reply