-->
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.  [ 1 post ] 
Author Message
 Post subject: Transaction Begin stuck
PostPosted: Wed Jan 12, 2011 2:13 am 
Newbie

Joined: Tue Aug 29, 2006 2:54 am
Posts: 16
Dear all
In my web application , I write a hibernate transaction filter as below
Code:
public class HibernateSessionRequestFilter implements Filter {

   public void doFilter(ServletRequest request, ServletResponse response,
         FilterChain chain) throws IOException, ServletException {

      Transaction tx = null;
      try {
         logger.warn(HibernateServiceImpl.getCurrentSession());
         tx = HibernateServiceImpl.getCurrentSession().getTransaction();
         if (!(tx != null && tx.isActive())) {
            tx.begin();
         }
         chain.doFilter(request, response);
         if (tx != null && tx.isActive()) {
            tx.commit();
         }

      } catch (Exception e) {
         try {
            if (tx != null && tx.isActive()) {
               tx.rollback();
            }
         } catch (Exception ex) {
                           ex.printStackTrace();
         }
      }
   }


There is a frame in the jsp page as below
Code:
<frameset  cols="40%,60%" id="myframe" frameborder="no" border="0" framespacing="0"> 
<frame src="${pageContext.request.contextPath}/left.do?act=showdata" name="leftFrame" id="leftFrame" scrolling="yes"> 
<frame src="${pageContext.request.contextPath}/right.do?act=queryUserData&default=yes" name="rightFrame" id="rightFrame" scrolling="yes"> 
</frameset> 


When client enter into the jsp page.
The server side receives leftFrame http request and rightFrame http request almost simultaneously.But one request will be stuck in the tx.begin(); until the anther request had been completed and commited. But I think both request should proceed simultaneously.
Can someone tell me why the phenomenon occur?
I deploy the web application on Tomcat. My hibernate setting as below
Code:
<property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
            <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.current_session_context_class">thread</prop>
            <prop key="hibernate.jdbc.batch_size">100</prop>
         </props>
      </property>


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

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.