javax.transaction

Interface Transaction


  • public interface Transaction
    The Transaction interface allows operations to be performed against the transaction in the target Transaction object. A Transaction object is created corresponding to each global transaction creation. The Transaction object can be used for resource enlistment, synchronization registration, transaction completion, and status query operations.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void commit()
      Complete the transaction represented by this Transaction object.
      boolean delistResource(XAResource xaRes, int flag)
      Disassociate the resource specified from the transaction associated with the target Transaction object.
      boolean enlistResource(XAResource xaRes)
      Enlist the resource specified with the transaction associated with the target Transaction object.
      int getStatus()
      Obtain the status of the transaction associated with the target Transaction object.
      void registerSynchronization(Synchronization sync)
      Register a synchronization object for the transaction currently associated with the target object.
      void rollback()
      Rollback the transaction represented by this Transaction object.
      void setRollbackOnly()
      Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.

      Erste Seite von API Java Inhaltsverzeichnis Haut

    • Method Detail

      • delistResource

        boolean delistResource(XAResource xaRes,
                               int flag)
                        throws IllegalStateException,
                               SystemException
        Disassociate the resource specified from the transaction associated with the target Transaction object.
        Parameters:
        xaRes - The XAResource object associated with the resource (connection).
        flag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.
        Returns:
        true if the resource was delisted successfully; otherwise false.
        Throws:
        IllegalStateException - Thrown if the transaction in the target object is inactive.
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • enlistResource

        boolean enlistResource(XAResource xaRes)
                        throws RollbackException,
                               IllegalStateException,
                               SystemException
        Enlist the resource specified with the transaction associated with the target Transaction object.
        Parameters:
        xaRes - The XAResource object associated with the resource (connection).
        Returns:
        true if the resource was enlisted successfully; otherwise false.
        Throws:
        RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
        IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • getStatus

        int getStatus()
               throws SystemException
        Obtain the status of the transaction associated with the target Transaction object.
        Returns:
        The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.
        Throws:
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • registerSynchronization

        void registerSynchronization(Synchronization sync)
                              throws RollbackException,
                                     IllegalStateException,
                                     SystemException
        Register a synchronization object for the transaction currently associated with the target object. The transction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method.
        Parameters:
        sync - The Synchronization object for the transaction associated with the target object.
        Throws:
        RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
        IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • rollback

        void rollback()
               throws IllegalStateException,
                      SystemException
        Rollback the transaction represented by this Transaction object.
        Throws:
        IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • setRollbackOnly

        void setRollbackOnly()
                      throws IllegalStateException,
                             SystemException
        Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.
        Throws:
        IllegalStateException - Thrown if the target object is not associated with any transaction.
        SystemException - Thrown if the transaction manager encounters an unexpected error condition.

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/Transaction.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, Transaction (Java(TM) EE 7 Specification APIs)

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.