Announcement Announcement Module
Collapse
No announcement yet.
Hibernate Test hang after execution the first one Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate Test hang after execution the first one

    Hi,

    I'm newbie in Spring, I've try to find some relative problem in forum without success.

    I've define a class that extends HibernateDaoSupport as described in the example I've declared a xml file :
    <bean id="taskProxy" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref local="transactionManager"/></property>
    <property name="target">
    <bean class="com.shopping.roadrunner.dao.TaskProviderHib ernateWtb">
    <property name="sessionFactory"><ref local="mySessionFactory"/></property>
    </bean>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    <bean id="taskprovider" class="com.shopping.roadrunner.dao.TaskProviderHib ernateWtb">
    <property name="sessionFactory"> <ref local="mySessionFactory" />
    </property>
    </bean>

    I've written a test
    :
    public class TaskProviderHibernateWtbTest extends AbstractTransactionalDataSourceSpringContextTests {

    @Override
    protected String[] getConfigLocations() {
    return new String[] {"roadrunnertesthibernate.xml"};
    }

    public void testGetAllTasks() {
    TaskProviderHibernateWtb wtbTaskProvider = (TaskProviderHibernateWtb) applicationContext.getBean("taskprovider");
    List tasks = wtbTaskProvider.getAllTasks();

    assertNotNull(tasks);
    }

    public void testGetNextTask() throws Exception {
    TaskProviderHibernateWtb wtbTaskProvider = (TaskProviderHibernateWtb) applicationContext.getBean("taskprovider");
    wtbTaskProvider.getNextTask();
    }

    All is ok for the first test when try to execute the second one the test just hang no progress anymore.

    here is a trace report
    Oct 15, 2006 4:19:29 PM org.springframework.orm.hibernate3.HibernateTransa ctionManager afterPropertiesSet
    INFO: Using DataSource [org.apache.commons.dbcp.BasicDataSource@15575e0] of Hibernate SessionFactory for HibernateTransactionManager
    Oct 15, 2006 4:19:29 PM org.springframework.aop.framework.DefaultAopProxyF actory <clinit>
    INFO: CGLIB2 available: proxyTargetClass feature enabled
    Oct 15, 2006 4:19:30 PM org.springframework.jdbc.datasource.JdbcTransactio nObjectSupport <clinit>
    INFO: JDBC 3.0 Savepoint class is available
    Oct 15, 2006 4:19:30 PM org.springframework.test.AbstractTransactionalSpri ngContextTests startNewTransaction
    INFO: Began transaction (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransa ctionManager@61736e]; default rollback = true
    Oct 15, 2006 4:19:30 PM org.springframework.test.AbstractTransactionalSpri ngContextTests endTransaction
    INFO: Rolled back transaction after test execution
    Oct 15, 2006 4:19:30 PM org.springframework.test.AbstractTransactionalSpri ngContextTests startNewTransaction
    INFO: Began transaction (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransa ctionManager@61736e]; default rollback = true
    We see clearly it's about to start a new transaction but get stucked inside
    I really dont know what to do. The transaction are not important for me cause I'm using Oracle stored procedure

    Any help is welcomed

    Thanks

  • #2
    Hi

    It's happen because I've used the hibernate session directly whe n using HibernateDaoSupport we need to use the getHibernateTemplate object and use the method provided

    Comment

    Working...
    X