javax.transaction

Annotation Type Transactional


  • @Inherited
     @InterceptorBinding
     @Target(value={TYPE,METHOD})
     @Retention(value=RUNTIME)
    public @interface Transactional

    The javax.transaction.Transactional annotation provides the application the ability to declaratively control transaction boundaries on CDI managed beans, as well as classes defined as managed beans by the Java EE specification, at both the class and method level where method level annotations override those at the class level.

    See the EJB specification for restrictions on the use of @Transactional with EJBs.

    This support is provided via an implementation of CDI interceptors that conduct the necessary suspending, resuming, etc. The Transactional interceptor interposes on business method invocations only and not on lifecycle events. Lifecycle methods are invoked in an unspecified transaction context.

    If an attempt is made to call any method of the UserTransaction interface from within the scope of a bean or method annotated with @Transactional and a Transactional.TxType other than NOT_SUPPORTED or NEVER, an IllegalStateException must be thrown. The use of the UserTransaction is allowed within life cycle events. The use of the TransactionSynchronizationRegistry is allowed regardless of any @Transactional annotation.

    The Transactional interceptors must have a priority of Interceptor.Priority.PLATFORM_BEFORE+200. Refer to the Interceptors specification for more details.

    The TxType element of the annotation indicates whether a bean method is to be executed within a transaction context. TxType.REQUIRED is the default.

    By default checked exceptions do not result in the transactional interceptor marking the transaction for rollback and instances of RuntimeException and its subclasses do. This default behavior can be modified by specifying exceptions that result in the interceptor marking the transaction for rollback and/or exceptions that do not result in rollback.

    The rollbackOn element can be set to indicate exceptions that must cause the interceptor to mark the transaction for rollback.

    Conversely, the dontRollbackOn element can be set to indicate exceptions that must not cause the interceptor to mark the transaction for rollback.

    When a class is specified for either of these elements, the designated behavior applies to subclasses of that class as well. If both elements are specified, dontRollbackOn takes precedence.

    Since:
    JTA1.2
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element and Description
      Class[] dontRollbackOn
      The dontRollbackOn element can be set to indicate exceptions that must not cause the interceptor to mark the transaction for rollback.
      Class[] rollbackOn
      The rollbackOn element can be set to indicate exceptions that must cause the interceptor to mark the transaction for rollback.
      Transactional.TxType value
      The TxType element of the Transactional annotation indicates whether a bean method is to be executed within a transaction context.

      Erste Seite von API Java Inhaltsverzeichnis Haut

    • Element Detail

      • value

        public abstract Transactional.TxType value
        The TxType element of the Transactional annotation indicates whether a bean method is to be executed within a transaction context.
        Default:
        javax.transaction.Transactional.TxType.REQUIRED
      • rollbackOn

        public abstract Class[] rollbackOn
        The rollbackOn element can be set to indicate exceptions that must cause the interceptor to mark the transaction for rollback. Conversely, the dontRollbackOn element can be set to indicate exceptions that must not cause the interceptor to mark the transaction for rollback. When a class is specified for either of these elements, the designated behavior applies to subclasses of that class as well. If both elements are specified, dontRollbackOn takes precedence.
        Returns:
        Class[] of Exceptions
        Default:
        {}
      • dontRollbackOn

        public abstract Class[] dontRollbackOn
        The dontRollbackOn element can be set to indicate exceptions that must not cause the interceptor to mark the transaction for rollback. Conversely, the rollbackOn element can be set to indicate exceptions that must cause the interceptor to mark the transaction for rollback. When a class is specified for either of these elements, the designated behavior applies to subclasses of that class as well. If both elements are specified, dontRollbackOn takes precedence.
        Returns:
        Class[] of Exceptions
        Default:
        {}

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/transaction/transactional.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.