Hi,
I am using:
- Atomikos 3.5.4
- Spring 2.5.6
- Hibernate 3.2.6
I am using Spring + Hibernate with DAO based on plain Hibernate API (
http://static.springframework.org/sprin ... e-straight), This is an example:
this.sessionFactory.getCurrentSession().createQuery("from ...");
I have a problem that Atomikos transaction manager is forced to close pending prepared statement when transaction aborts. It causes an overhead.
(The problem is described here:
http://fogbugz.atomikos.com/default.asp?community.6.668.5)
I would like to close the prepared statements using Hibernate API myself. However, I do not know how to accomplish that task. There are no such methods in the Session or Query interfaces. Any hints?
Thanks in advance for your help.
Regards,
Tom
My configuration of Hibernate Beans looks like this:
Code:
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
<context:load-time-weaver />
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
<context:annotation-config />
<context:component-scan base-package="XXX" />
<bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close">
<property name="uniqueResourceName"><value>DATABASE_XADBMS</value></property>
<property name="xaDataSourceClassName" value="oracle.jdbc.xa.client.OracleXADataSource"/>
<property name="xaProperties">
<props>
<prop key="user">${db.username}</prop>
<prop key="password">${db.password}</prop>
<prop key="URL">${db.url}</prop>
</props>
</property>
<property name="poolSize" value="15" />
<property name="maxPoolSize" value="30" />
<property name="maxIdleTime" value="15" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="annotatedClasses">
<list>
<value>XXX.XXX</value>
</list>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration
</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9iDialect
</prop>
<prop key="hibernate.query.substitutions">
true=1 false=0
</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.use_sql_comments">false</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<!-- http://www.atomikos.com/Documentation/JtaProperties -->
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
<prop key="javax.persistence.transactionType">jta</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
<prop key="hibernate.connection.release_mode">auto</prop>
<prop key="hibernate.transaction.flush_before_completion">true"</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>