Path: blob/master/src/java.sql/share/classes/java/sql/SQLTransactionRollbackException.java
41153 views
/*1* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627/**28* The subclass of {@link SQLException} thrown when the SQLState class value29* is '<i>40</i>', or under vendor-specified conditions. This indicates that the30* current statement was automatically rolled back by the database because31* of deadlock or other transaction serialization failures.32* <p>33* Please consult your driver vendor documentation for the vendor-specified34* conditions for which this {@code Exception} may be thrown.35* @since 1.636*/37public class SQLTransactionRollbackException extends SQLTransientException {38/**39* Constructs a {@code SQLTransactionRollbackException} object.40* The {@code reason}, {@code SQLState} are initialized41* to {@code null} and the vendor code is initialized to 0.42*43* The {@code cause} is not initialized, and may subsequently be44* initialized by a call to the45* {@link Throwable#initCause(java.lang.Throwable)} method.46*47* @since 1.648*/49public SQLTransactionRollbackException() {50super();51}5253/**54* Constructs a {@code SQLTransactionRollbackException} object55* with a given {@code reason}. The {@code SQLState}56* is initialized to {@code null} and the vendor code is initialized57* to 0.58*59* The {@code cause} is not initialized, and may subsequently be60* initialized by a call to the61* {@link Throwable#initCause(java.lang.Throwable)} method.62*63* @param reason a description of the exception64* @since 1.665*/66public SQLTransactionRollbackException(String reason) {67super(reason);68}6970/**71* Constructs a {@code SQLTransactionRollbackException} object72* with a given {@code reason} and {@code SQLState}.73*74* The {@code cause} is not initialized, and may subsequently be75* initialized by a call to the76* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code77* is initialized to 0.78*79* @param reason a description of the exception80* @param SQLState an XOPEN or SQL:2003 code identifying the exception81* @since 1.682*/83public SQLTransactionRollbackException(String reason, String SQLState) {84super(reason, SQLState);85}8687/**88* Constructs a {@code SQLTransactionRollbackException} object89* with a given {@code reason}, {@code SQLState} and90* {@code vendorCode}.91*92* The {@code cause} is not initialized, and may subsequently be93* initialized by a call to the94* {@link Throwable#initCause(java.lang.Throwable)} method.95*96* @param reason a description of the exception97* @param SQLState an XOPEN or SQL:2003 code identifying the exception98* @param vendorCode a database vendor specific exception code99* @since 1.6100*/101public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode) {102super(reason, SQLState, vendorCode);103}104105/**106* Constructs a {@code SQLTransactionRollbackException} object107* with a given {@code cause}.108* The {@code SQLState} is initialized109* to {@code null} and the vendor code is initialized to 0.110* The {@code reason} is initialized to {@code null} if111* {@code cause==null} or to {@code cause.toString()} if112* {@code cause!=null}.113*114* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating115* the cause is non-existent or unknown.116* @since 1.6117*/118public SQLTransactionRollbackException(Throwable cause) {119super(cause);120}121122/**123* Constructs a {@code SQLTransactionRollbackException} object124* with a given125* {@code reason} and {@code cause}.126* The {@code SQLState} is initialized to {@code null}127* and the vendor code is initialized to 0.128*129* @param reason a description of the exception.130* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating131* the cause is non-existent or unknown.132* @since 1.6133*/134public SQLTransactionRollbackException(String reason, Throwable cause) {135super(reason, cause);136}137138/**139* Constructs a {@code SQLTransactionRollbackException} object140* with a given141* {@code reason}, {@code SQLState} and {@code cause}.142* The vendor code is initialized to 0.143*144* @param reason a description of the exception.145* @param SQLState an XOPEN or SQL:2003 code identifying the exception146* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating147* the cause is non-existent or unknown.148* @since 1.6149*/150public SQLTransactionRollbackException(String reason, String SQLState, Throwable cause) {151super(reason, SQLState, cause);152}153154/**155* Constructs a {@code SQLTransactionRollbackException} object156* with a given157* {@code reason}, {@code SQLState}, {@code vendorCode}158* and {@code cause}.159*160* @param reason a description of the exception161* @param SQLState an XOPEN or SQL:2003 code identifying the exception162* @param vendorCode a database vendor-specific exception code163* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating164* the cause is non-existent or unknown.165* @since 1.6166*/167public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode, Throwable cause) {168super(reason, SQLState, vendorCode, cause);169}170171private static final long serialVersionUID = 5246680841170837229L;172}173174175