As title say I have problem with transaction timeout attribute because it doesn't rollback transaction after specific time and query is still running.
I'm using Spring 2.5.6, Hibernate 3.3.2, Wicket 1.4.5 on Weblogic 10.3 and Informix 10.
Here's my code and configuration:
Code:<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> <property name="configLocation" value="classpath:hibernate.cfg.xml"> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="txManager"/> <bean id="myWeBApp" class="com.web.MyWebApplication"> <property name="tlogDAO" ref="tlogDAO"/> </bean> <bean id="tlogDAO" class="com.dao.TlogDAOImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean>But if I change findAll method to this form I will get what I expect:Code:public class TlogDAOImpl implements TlogDAO { private HibernateTemplate hibernateTemplate; public void setSessionFactory(SessionFactory sessionFactory) { this.hibernateTemplate = new HibernateTemplate(sessionFactory); } @SuppressWarnings("unchecked") @Override @Transactional(readOnly=true, timeout=30) public List<Tlog> findAll(Tlog instance) { return hibernateTemplate.findByExample(instance); } }
Error:Code:public List<Tlog> findAll(Tlog instance) { try { Thread.sleep(30000); } catch (InterruptedException e) { e.printStackTrace(); } return hibernateTemplate.findByExample(instance); }
Although transaction is expired on my console sql is shown but I am quite sure that query is not executed.Code:org.hibernate.TransactionException: transaction timeout expired at org.hibernate.jdbc.AbstractBatcher.setTimeout(AbstractBatcher.java:552) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:538)
So the quesion is: why primary version doesn't work?
Thanks for all responses and suggestions.
Best Regards,
Luke


Reply With Quote