-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to explictly close PreparedStatement using plain API
PostPosted: Fri May 15, 2009 4:15 pm 
Newbie

Joined: Fri May 15, 2009 4:02 pm
Posts: 2
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>


Top
 Profile  
 
 Post subject: Re: How to explictly close PreparedStatement using plain API
PostPosted: Fri May 27, 2011 9:47 am 
Newbie

Joined: Fri May 27, 2011 9:45 am
Posts: 1
Did you found a solution ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.