Estou fazendo aplicação com hibernate + struts + mssql. De inicio tenho somente uma tabela estou fazendo consulta e inserção. Fiz o teste no banco de dados MySQL e MSSQL.
OBS: No MySQL funcionou normalmente só q no MSSQL já não funcionou tão bem assim ele está instavel onde eu faço uma consulta normal nao da erro ai faço de novo a mesma consulta da erro ou seja bem instavel segue abaixo os meus arquivos de configurações, logs. Por favor se alguem souber agradeço.
hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property
name="hibernate.connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<property
name="hibernate.connection.url">
jdbc:microsoft:sqlserver://servidor:1433;DatabaseName=bancoDados
</property>
<property
name="hibernate.connection.username">
usuario
</property>
<property
name="hibernate.connection.password">
senha
</property>
<!-- Condiguração do c3p0 -->
<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.timeout">5000</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<!-- Configurações de debug -->
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.use_sql_comments">true</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Drop and re-create the database schema on startup -->
<!-- <property name="hbm2ddl.auto">create</property>-->
<mapping resource="br/com/bull/bean/UserAdmin.hbm.xml"/>
</session-factory>
</hibernate-configuration>
UserAdmin.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="br.com.bull.bean.UserAdminBean" table="USERADMIN">
<id name="id" column="idUserAdmin">
<generator class="identity"/>
</id>
<property name="nome" />
<property name="re" />
<property name="createDT" type="calendar" />
<property name="senha" />
</class>
</hibernate-mapping>
Metodo que chama a consulta
public List listar(String coluna,String operador,String valor) throws HibernateException{
//Session session = HibernateUtility.currentSession();
List listAdministradores = null;
try{
HibernateUtility.beginTransaction();
if(operador.equals("like")){
Criteria criteriaLike = HibernateUtility.currentSession().createCriteria(UserAdminBean.class);
criteriaLike
.add(Restrictions.like(coluna,valor,MatchMode.ANYWHERE))
.addOrder(Order.asc(coluna));
listAdministradores = criteriaLike.list() ;
}
HibernateUtility.commitTransaction();
System.err.println("7");
}catch(HibernateException e){
HibernateUtility.rollbackTransaction();
System.err.println(e.toString());
throw e;
}finally{
HibernateUtility.closeSession();
}
return listAdministradores;
}
LOGS de ERRO
[13/03/07 13:08:27:158 GMT-03:00] 6ed56040 SystemOut O Hibernate: /* criteria query */ select this_.idUserAdmin as idUserAd1_0_0_, this_.nome as nome0_0_, this_.re as re0_0_, this_.createDT as createDT0_0_, this_.senha as senha0_0_ from USERADMIN this_ where this_.nome like ? order by this_.nome asc
[13/03/07 13:08:27:538 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Warning: 0, SQLState:
[13/03/07 13:08:28:510 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to wflgcdi
[13/03/07 13:08:28:550 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Warning: 0, SQLState:
[13/03/07 13:08:28:560 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'wflgcdi'.
[13/03/07 13:08:28:560 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Warning: 0, SQLState:
[13/03/07 13:08:28:570 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english
[13/03/07 13:08:28:580 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Warning: 0, SQLState:
[13/03/07 13:08:28:590 GMT-03:00] 6ed56040 JDBCException W org.hibernate.util.JDBCExceptionReporter [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english.
[13/03/07 13:08:36:812 GMT-03:00] 55aaa041 SystemOut O Hibernate: /* criteria query */ select this_.idUserAdmin as idUserAd1_0_0_, this_.nome as nome0_0_, this_.re as re0_0_, this_.createDT as createDT0_0_, this_.senha as senha0_0_ from USERADMIN this_ where this_.nome like ? order by this_.nome asc
[13/03/07 13:08:36:902 GMT-03:00] 55aaa041 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Error: 0, SQLState: 08007
[13/03/07 13:08:38:024 GMT-03:00] 55aaa041 JDBCException E org.hibernate.util.JDBCExceptionReporter [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
[13/03/07 13:08:38:044 GMT-03:00] 55aaa041 SystemErr R org.hibernate.exception.JDBCConnectionException: could not execute query