Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-1496

@Transactional doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.0.0.Beta1
    • 8.0.0.Alpha2
    • JCA, Transactions
    • None

      I just tried the WildFly Alpha 2 snapshot containing Narayana 5.0.0.M3 and get the error message below. The classes causing the error are:
      @Path("/bestellungen")
      @Produces(

      { APPLICATION_JSON, APPLICATION_XML }

      )
      //@RequestScoped is default for JAX-RS
      @Transactional
      public class BestellungResource {
      @Inject
      private BestellungService bs;
      ...
      }

      @Transactional(TxType.MANDATORY)
      public class BestellungServiceImpl implements Serializable {
      private static final long serialVersionUID = ...L;

      @PersistenceContext
      private transient EntityManager em;

      // method invoking JPA / Hibernate
      }

      The fragment of server.log:
      15:11:43,254 DEBUG [org.hibernate.SQL]
      /* named HQL query Bestellung.findKundeById */ select
      distinct abstractku1_.id as id2_8_,
      abstractku1_.aktualisiert as aktualis3_8_,
      abstractku1_.bemerkungen as bemerkun4_8_,
      abstractku1_.email as email5_8_,
      abstractku1_.erzeugt as erzeugt6_8_,
      abstractku1_.file_fk as file18_8_,
      abstractku1_.kategorie as kategori7_8_,
      abstractku1_.nachname as nachname8_8_,
      abstractku1_.newsletter as newslett9_8_,
      abstractku1_.password as passwor10_8_,
      abstractku1_.rabatt as rabatt11_8_,
      abstractku1_.seit as seit12_8_,
      abstractku1_.umsatz as umsatz13_8_,
      abstractku1_.version as version14_8_,
      abstractku1_.vorname as vorname15_8_,
      abstractku1_.familienstand_fk as familie16_8_,
      abstractku1_.geschlecht_fk as geschle17_8_,
      abstractku1_.art as art1_8_
      from
      Bestellung bestellung0_
      inner join
      kunde abstractku1_
      on bestellung0_.kunde_fk=abstractku1_.id
      where
      bestellung0_.id=?
      15:11:43,254 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: null
      15:11:43,254 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] UserTransaction is not available within the scope of a bean or method annotated with @Transactional and a Transactional.TxType other than NOT_SUPPORTED or NEVER

              smaestri@redhat.com Stefano Maestri
              juergen.zimmermann Juergen Zimmermann (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: