0 Replies Latest reply on Nov 9, 2010 11:35 AM by Gab Aldian

    I can't manage to have valid active transactions

    Gab Aldian Newbie

      From components.xml:



          <!-- HIBERNATE SETTINGS -->              
          <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
          <persistence:managed-hibernate-session name="myDatabase"
                                          session-factory="#{hibernateSessionFactory}"
                                          auto-create="true"/>
          <transaction:hibernate-transaction session="#{myDatabase}"  />
          <factory name="session"
                 scope="STATELESS"
                 auto-create="true"
                 value="#{myDatabase}"/>



      From hibernate.cfg.xml:



      <session-factory name="hibernateSessionFactory">
              <property name="transaction.flush_before_completion">true</property>
               <property name="connection.release_mode">after_statement</property>
                <property name="transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</property>
                <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>



      From the log when running the application :



      org.hibernate.HibernateException: createCriteria is not valid without active transaction
           at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338)
           at $Proxy36.createCriteria(Unknown Source)
           at dao.DatabaseAccess.findAll(DatabaseAccess.java:47)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



      I tried to change or comment some parameters, but couldn't make anything work, just managed to have different errors. As for the use of JOTMTransactionManagerLookup instead of JBossTransactionManagerLookup, it is because I am running with tomcat.


      Could you help me?