1 Reply Latest reply on Dec 21, 2008 9:07 AM by Yiu Wing Tsang

    do not auto commit after method is returned

    Yiu Wing Tsang Newbie

      jboss 4.2
      ejb 3
      stateless session bean
      transaction = container managed, REQUIRED
      using jboss-spring interceptor to inject dependencies (e.g. the hibernate dao) to the session bean

      we are using ejb 3 stateless session bean to wrap the hibernate codes to do database CRUD
      (just simple hibernate, not ejb3 entity)

      it happens that

      no "COMMIT" happens after the session bean is returned successfully, i.e. the hibernate update is not flushed to db;

      but the changes can be updated to db if we call "hibernate session's flush" explicitly

      we want to use container managed transaction, so any hint to my problem?


        • 1. Re: do not auto commit after method is returned
          Yiu Wing Tsang Newbie


          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
           <persistence-unit name="angelfish">
           <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>

           <property name="connection.datasource">java:/OracleDS</property>
           <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
           <property name="show_sql">true</property>
           <property name="format_sql">true</property>

          class annotations of session bean

          i have tried to add the @TransactionAttribute to the method, it also does not work

          in fact, i also tried to implement SessionSynchronization
          but for the all three callback methods

          i have added debug print outs, it seems that the SessionSynchornization methods are not called

          but i am quite sure a transaction should be opened, otherwise, i will receive complain from hibernate ,
          the situation now is, no exception occurs in executing the session bean method, every thing looks fine except that the updated data is not committed/flushed to db, unless we call hibernate session's flush explicitly