Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate3 ConnectionPooling and/or cache problem  RSS feed

Gergely Kakuszi
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have started using Hibernate recently, and I am still struggling with the correct setup. The first problem was a quite common one, namely making hibernate to be able to reconnect to the mysql database, after a database connection loss or termination. This could be achieved by using C3P0. Now I am facing another problem, that somehow I am not able to solve myself. I thought the problem was cache related, so I looked through other topics but I did not find a solution that worked for me.

The problem is:
1. I execute an hql that counts rows based on a simple where clause
2. I modify the database directly (knowing that if I execute the above query again I should get a different result)
3. I execute the query againg, but the result is the same as the first query's...

I have downloaded the latest mysql connector. And using tomcat5.5 on Debian and MySQL version 5.0.51a-24 with Hibernate3.

I made several tweaks and patches to the original hibernate.cfg.xml, it presently looks like this:

<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/dbname?autoReconnect=true</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>

<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

<property name="show_sql">true</property>
<property name="cache.use_query_cache">false</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="cache.use_second_level_cache">false</property>
<property name="cache.use_query_cache">false</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">5</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->


Can someone please point me to the right direction what could be wrong here? The query returs the new value only after I restart tomcat...

Thank you,
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!