1 Reply Latest reply on Feb 15, 2009 4:03 PM by Gerbrand van Dieijen

    Why every find / select query executes a commit?

    Fabian Cuesta Newbie

      Hi
      Profiling my EJB 3.0 project I've found that every EJB method that calls a select query or an entity manager em.find, executed a oracle.jdbc.driver.PhysicalConnection.commit().

      How can avoid this? I've tried changing the transaction attribute of the method but nothing hapend. Is there any read only way to execute the queries?

      I'm using JBoss-4.2.0.GA and Oracle 10.

      Regards

      Fabian

        • 1. Re: Why every find / select query executes a commit?
          Gerbrand van Dieijen Newbie

          Do you also annotate your class with a transaction attribute?

          We use
          @TransactionAttribute( TransactionAttributeType.REQUIRED )

          That should be the default, although I'm not sure. With the above attribute, when a (EJB) method within an existing transaction, that transaction is used. A new transaction is started only when no transaction exists/is started.

          With: @TransactionAttribute( TransactionAttributeType.NEW_REQUIRED ) every ejb method will use its own transaction.