Ainda o Hibernate gerando Communication Link Failure

Minha configuração do Hibernate:

			hibernateConfig = new AnnotationConfiguration();
			
			hibernateConfig.setProperty("hibernate.dialect", props.getString("hibernate.dialect"));
			hibernateConfig.setProperty("hibernate.connection.driver_class", driver);
			hibernateConfig.setProperty("hibernate.connection.url", url);
			hibernateConfig.setProperty("hibernate.connection.username", user);
			hibernateConfig.setProperty("hibernate.connection.password", pass);
			hibernateConfig.setProperty("hibernate.hbm2ddl.auto", props.getString("hibernate.hbm2dll.auto"));
			hibernateConfig.setProperty("hibernate.show_sql", props.getString("hibernate.show_sql"));
			
			// c3p0
			
			hibernateConfig.setProperty("hibernate.c3p0.acquire_increment", "1");
			hibernateConfig.setProperty("hibernate.c3p0.idle_test_period", "300");
			hibernateConfig.setProperty("hibernate.c3p0.timeout", "120");
			//hibernateConfig.setProperty("hibernate.c3p0.max_size","4"); // ATTENTION: This line will make hibernate go crazy, missing criterias selections like
																		  // the row was not even there. Yes I love Hibernate! Uncomment and run the tests to find
																		  // out for yourself. Basically if you call UserDAO.findByUsername in a row, the first time
																		  // it works, the second time it returns null. It is like the first criteria selection is
																		  // removing the record from the database.
			hibernateConfig.setProperty("hibernate.c3p0.min_size", "1");
			hibernateConfig.setProperty("hibernate.c3p0.max_statement", "0");
			hibernateConfig.setProperty("hibernate.c3p0.preferredTestQuery", "select 1;");

Depois de um tempo, irremediavelmente eu recebo:


com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

O que está faltando? Seria o hibernate.c3p0.maxIdleTime ?

e ai comeca a dar direto?

a configuracao testConnectionOnCheckout para true do c3p0 deve resolver o problema, mas nao é o ideal

Valeu Paulo, vou testar!

saoj

Conseguiu resolver o problema? Com a dica do Paulo?

Começei a ter esse mesmo problema quando mudei para o hibernate 3.6. Você usa também o hibernate 3.6?

Obrigado

Resolvido.

Faltava o jar hibernate-c3p0-3.6.0.Final.jar.