001: /*
002: * Copyright 2004 Clinton Begin
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package com.ibatis.common.jdbc.exception;
017:
018: import java.sql.SQLException;
019:
020: /**
021: * Class to allow passing an Exception with the original SQLException
022: */
023: public class NestedSQLException extends SQLException {
024:
025: /**
026: * Constructor from java.sql.SQLException
027: * @see java.sql.SQLException
028: * @param msg - the message for the exception
029: */
030: public NestedSQLException(String msg) {
031: super (msg);
032: }
033:
034: /**
035: * Constructor from java.sql.SQLException
036: * @see java.sql.SQLException
037: * @param reason - the reason for the exception
038: * @param SQLState - the SQLState
039: */
040: public NestedSQLException(String reason, String SQLState) {
041: super (reason, SQLState);
042: }
043:
044: /**
045: * Constructor from java.sql.SQLException
046: * @see java.sql.SQLException
047: * @param reason - the reason for the exception
048: * @param SQLState - the SQLState
049: * @param vendorCode - a vendor supplied code to go w/ the message
050: */
051: public NestedSQLException(String reason, String SQLState,
052: int vendorCode) {
053: super (reason, SQLState, vendorCode);
054: }
055:
056: /**
057: * Constructor from java.sql.SQLException with added nested exception
058: * @param msg - the message for the exception
059: * @param cause - the cause of the exception
060: */
061: public NestedSQLException(String msg, Throwable cause) {
062: super (msg);
063: initCause(cause);
064: }
065:
066: /**
067: * Constructor from java.sql.SQLException with added nested exception
068: * @see java.sql.SQLException
069: * @param reason - the reason for the exception
070: * @param SQLState - the SQLState
071: * @param cause - the cause of the exception
072: */
073: public NestedSQLException(String reason, String SQLState,
074: Throwable cause) {
075: super (reason, SQLState);
076: initCause(cause);
077: }
078:
079: /**
080: * Constructor from java.sql.SQLException with added nested exception
081: * @param reason - the reason for the exception
082: * @param SQLState - the SQLState
083: * @param vendorCode - a vendor supplied code to go w/ the message
084: * @param cause - the cause of the exception
085: */
086: public NestedSQLException(String reason, String SQLState,
087: int vendorCode, Throwable cause) {
088: super (reason, SQLState, vendorCode);
089: initCause(cause);
090: }
091:
092: /**
093: * Constructor from java.sql.SQLException with added nested exception
094: * @param cause - the cause of the exception
095: */
096: public NestedSQLException(Throwable cause) {
097: super();
098: initCause(cause);
099: }
100: }
|