-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate3 ConnectionPooling and/or cache problem
PostPosted: Sun Jul 26, 2009 4:14 am 
Newbie

Joined: Sun Jul 26, 2009 4:07 am
Posts: 1
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. After reading ang google-ing I thought that this could be solved 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:

<session-factory>

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

<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">user</property>
<property name="connection.password">password</property>

<property name="show_sql">true</property>

<!-- Cache related entries-->
<property name="cache.use_query_cache">false</property>
<property name="cache.use_second_level_cache">false</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Connection pooling -->
<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 -->

</session-factory>


Further more, c3p0 did not solve the "Communications link failure during commit(). Transaction resolution unknown." problem either.
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,
Gergely


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.