Bom dia Pessoal, estou com um problema chato de resolver.
Seguinte estou usando a versão hibernate-3.2.1.ga.
Quando eu conecto com o Hibernate no mySQL com o arquivo hibernate.cfg.xml.
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/teste</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<property name="hbm2ddl.auto">create-drop</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
Tranquilo, ele “printa” o SQL no console. Agora o problema.
Quando eu uso este mesmo com o WebSphere conectando no DB2 ele não “printa” nada de SQL no console.
O que muda é que as configurações do hibernate que fica em hibernate.cfg.xml eu faço com Spring… veja…
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>${dataService.dao.hibernate.config.Tabela1.mappingResources}</value>
<value>${dataService.dao.hibernate.config.Tabela2.mappingResources}</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<!-- Needed for Datasources -->
<prop key="hibernate.statement_cache.size">
0
</prop>
<!-- General -->
<prop key="hibernate.default_schema">
${dataService.dao.hibernate.config.default_schema}
</prop>
<prop key="hibernate.dialect">
${dataService.dao.hibernate.config.properties.hibernateDialect}
</prop>
<prop key="hibernate.hbm2ddl.auto">
${dataService.dao.hibernate.config.properties.hibernateAutoCreateUpdateDrop}
</prop>
// Aqui eu habilito
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.format_sql">
true
</prop>
<prop key="use_sql_comments">
true
</prop>
<!-- Disable the second-level cache-->
<prop key="hibernate.cache.use_second_level_cache">
${dataService.dao.hibernate.config.properties.hibernateCacheUsedSecondLevelCache}
</prop>
<!-- Enable Hibernate's automatic session context management -->
<prop key="current_session_context_class">
${dataService.dao.hibernate.config.properties.hibernateCurrentSessionContextClass}
</prop>
<prop key="hibernate.connection.provider_class">
${dataService.dao.hibernate.config.properties.hibernateConnectionProviderClass}
</prop>
<prop key="hibernate.connection.pool_size">
${dataService.dao.hibernate.config.properties.hibernateConnectionPoolSize}
</prop>
<prop key="hibernate.dbcp.maxWait">
12000
</prop>
<prop key="hibernate.cache.provider_class">
${dataService.dao.hibernate.config.properties.hibernateCacheProviderClass}
</prop>
<prop key="hibernate.cache.use_minimal_puts">
${dataService.dao.hibernate.config.properties.hibernateCacheUseMinimalPuts}
</prop>
<prop key="hibernate.cache.region_prefix">
${dataService.dao.hibernate.config.properties.hibernateCacheRegionPrefix}
</prop>
<prop key="hibernate.cache.use_query_cache">
${dataService.dao.hibernate.config.properties.hibernateCacheUseQueryCache}
</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
</entry>
</map>
</property>
</bean>
Alguem poderia me ajudar?
Grato