jdk/src/share/classes/java/sql/SQLTransactionRollbackException.java
changeset 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Sun designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Sun in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    23  * have any questions.
       
    24  */
       
    25 
       
    26 package java.sql;
       
    27 
       
    28 /**
       
    29  * The subclass of {@link SQLException} thrown when the SQLState class value is '<i>40</i>'. This indicates that the
       
    30  * current statement was automatically rolled back by the database becuase of deadlock or other
       
    31  * transaction serialization failures.
       
    32  *
       
    33  * @since 1.6
       
    34  */
       
    35 public class SQLTransactionRollbackException extends SQLTransientException {
       
    36         /**
       
    37          * Constructs a <code>SQLTransactionRollbackException</code> object.
       
    38          * The <code>reason</code>, <code>SQLState</code> are initialized
       
    39          * to <code>null</code> and the vendor code is initialized to 0.
       
    40          *
       
    41          * The <code>cause</code> is not initialized, and may subsequently be
       
    42          * initialized by a call to the
       
    43          * {@link Throwable#initCause(java.lang.Throwable)} method.
       
    44          * <p>
       
    45          * @since 1.6
       
    46          */
       
    47         public SQLTransactionRollbackException() {
       
    48                 super();
       
    49         }
       
    50 
       
    51         /**
       
    52          * Constructs a <code>SQLTransactionRollbackException</code> object
       
    53          * with a given <code>reason</code>. The <code>SQLState</code>
       
    54          * is initialized to <code>null</code> and the vender code is initialized
       
    55          * to 0.
       
    56          *
       
    57          * The <code>cause</code> is not initialized, and may subsequently be
       
    58          * initialized by a call to the
       
    59          * {@link Throwable#initCause(java.lang.Throwable)} method.
       
    60          * <p>
       
    61          * @param reason a description of the exception
       
    62          * @since 1.6
       
    63          */
       
    64         public SQLTransactionRollbackException(String reason) {
       
    65                 super(reason);
       
    66         }
       
    67 
       
    68         /**
       
    69          * Constructs a <code>SQLTransactionRollbackException</code> object
       
    70          * with a given <code>reason</code> and <code>SQLState</code>.
       
    71          *
       
    72          * The <code>cause</code> is not initialized, and may subsequently be
       
    73          * initialized by a call to the
       
    74          * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
       
    75          * is initialized to 0.
       
    76          * <p>
       
    77          * @param reason a description of the exception
       
    78          * @param SQLState an XOPEN or SQL:2003 code identifying the exception
       
    79          * @since 1.6
       
    80          */
       
    81         public SQLTransactionRollbackException(String reason, String SQLState) {
       
    82                 super(reason, SQLState);
       
    83         }
       
    84 
       
    85         /**
       
    86          * Constructs a <code>SQLTransactionRollbackException</code> object
       
    87          * with a given <code>reason</code>, <code>SQLState</code>  and
       
    88          * <code>vendorCode</code>.
       
    89          *
       
    90          * The <code>cause</code> is not initialized, and may subsequently be
       
    91          * initialized by a call to the
       
    92          * {@link Throwable#initCause(java.lang.Throwable)} method.
       
    93          * <p>
       
    94          * @param reason a description of the exception
       
    95          * @param SQLState an XOPEN or SQL:2003 code identifying the exception
       
    96          * @param vendorCode a database vendor specific exception code
       
    97          * @since 1.6
       
    98          */
       
    99         public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode) {
       
   100                 super(reason, SQLState, vendorCode);
       
   101         }
       
   102 
       
   103     /**
       
   104      * Constructs a <code>SQLTransactionRollbackException</code> object
       
   105      * with a given  <code>cause</code>.
       
   106      * The <code>SQLState</code> is initialized
       
   107      * to <code>null</code> and the vendor code is initialized to 0.
       
   108      * The <code>reason</code>  is initialized to <code>null</code> if
       
   109      * <code>cause==null</code> or to <code>cause.toString()</code> if
       
   110      * <code>cause!=null</code>.
       
   111      * <p>
       
   112      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
       
   113      *     the cause is non-existent or unknown.
       
   114      * @since 1.6
       
   115      */
       
   116     public SQLTransactionRollbackException(Throwable cause) {
       
   117         super(cause);
       
   118     }
       
   119 
       
   120     /**
       
   121      * Constructs a <code>SQLTransactionRollbackException</code> object
       
   122      * with a given
       
   123      * <code>reason</code> and  <code>cause</code>.
       
   124      * The <code>SQLState</code> is  initialized to <code>null</code>
       
   125      * and the vendor code is initialized to 0.
       
   126      * <p>
       
   127      * @param reason a description of the exception.
       
   128      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
       
   129      *     the cause is non-existent or unknown.
       
   130      * @since 1.6
       
   131      */
       
   132     public SQLTransactionRollbackException(String reason, Throwable cause) {
       
   133         super(reason, cause);
       
   134     }
       
   135 
       
   136     /**
       
   137      * Constructs a <code>SQLTransactionRollbackException</code> object
       
   138      * with a given
       
   139      * <code>reason</code>, <code>SQLState</code> and  <code>cause</code>.
       
   140      * The vendor code is initialized to 0.
       
   141      * <p>
       
   142      * @param reason a description of the exception.
       
   143      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
       
   144      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
       
   145      *     the cause is non-existent or unknown.
       
   146      * @since 1.6
       
   147      */
       
   148     public SQLTransactionRollbackException(String reason, String SQLState, Throwable cause) {
       
   149         super(reason, SQLState, cause);
       
   150     }
       
   151 
       
   152     /**
       
   153      *  Constructs a <code>SQLTransactionRollbackException</code> object
       
   154      * with a given
       
   155      * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
       
   156      * and  <code>cause</code>.
       
   157      * <p>
       
   158      * @param reason a description of the exception
       
   159      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
       
   160      * @param vendorCode a database vendor-specific exception code
       
   161      * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
       
   162      *     the cause is non-existent or unknown.
       
   163      * @since 1.6
       
   164      */
       
   165     public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode, Throwable cause) {
       
   166         super(reason, SQLState, vendorCode, cause);
       
   167     }
       
   168 
       
   169     private static final long serialVersionUID = 5246680841170837229L;
       
   170 }