Crash hibernate

Oi pessoal,

Estou tendo problemas na linha que inicia uma transação no hibernate3.1.
Entretanto, apenas ao variar a propriedade “hibernate.hbm2ddl.auto” de update para create tudo funciona.

O pior de tudo é que com create a estrutura é recriada no startup e fico no dilema: com update não funciona e com create não existe dados.
Alguém já vivenciou esta situação ?

Abaixo está o trecho de código:

	Session session = SystemController.getInstance().getSession();
	Transaction tx = session.beginTransaction();
           //estoura aqui!!!

	try {

		StringBuffer sb = new StringBuffer();
		sb.append("select distinct n.title, n.description ");
		sb.append("from News n ");	
			
		Query q = session.createSQLQuery(sb.toString());

		result = q.list();
		
		if (result.isEmpty()) {
			throw new BusinessException("Não há notícias cadastradas com essa palavra chave.");
		}
		
	} finally {
		tx.commit();
		session.close();
	}

	return result;
}	

O SGDB usado é o mysql4.1 com driver mysql-connector-3.1.12.

Liguei as opções de debug no log e obtive o trecho abaixo.
Notem que o update é completado e as threads interrompidas abruptamente.

2007-01-02 23:35:36,350 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete
2007-01-02 23:35:36,350 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@a8a81c [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1087d61)
2007-01-02 23:35:36,350 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@a8a81c [managed: 2, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1087d61)
2007-01-02 23:35:36,350 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@a8a81c [managed: 1, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1087d61)
2007-01-02 23:35:36,350 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@a8a81c [managed: 0, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1087d61)
2007-01-02 23:35:36,350 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] DEBUG com.mchange.v2.async.ThreadPoolAsynchronousRunner - Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] interrupted. Shutting down.
2007-01-02 23:35:36,350 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] DEBUG com.mchange.v2.async.ThreadPoolAsynchronousRunner - Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main] interrupted. Shutting down.
2007-01-02 23:35:36,350 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] DEBUG com.mchange.v2.async.ThreadPoolAsynchronousRunner - Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main] interrupted. Shutting down.
2007-01-02 23:35:36,365 [main] DEBUG com.mchange.v2.c3p0.PoolBackedDataSource - com.mchange.v2.c3p0.PoolBackedDataSource@58f769 has been closed. force_destroy == false
java.lang.Exception: Debug – PoolBackedDataSource.close() stack trace.
at com.mchange.v2.c3p0.PoolBackedDataSource.close(PoolBackedDataSource.java:214)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:259)
at com.mchange.v2.c3p0.DataSources.destroy(DataSources.java:226)
at org.hibernate.connection.C3P0ConnectionProvider.close(C3P0ConnectionProvider.java:118)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:175)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:295)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
at controller.HibernatePlugIn.init(HibernatePlugIn.java:37)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3880)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4141)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:680)
at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2007-01-02 23:35:36,365 [main] INFO org.hibernate.impl.SessionFactoryImpl - Checking 0 named HQL queries
2007-01-02 23:35:36,365 [main] INFO org.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
2007-01-02 23:35:36,381 [main] DEBUG org.apache.jasper.compiler.JspRuntimeContext - Parent class loader is: WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@35e6e3

Pessoal,

quando tudo parece complicado a mais simples solução resolve definitivamente.

Removi esta propriedade do .cfg.xml e tudo funcionou corretamente.

:smiley:

Porem, se alguém puder explicar o que houve seria ótimo.