01: package org.apache.ojb.broker;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.sql.SQLException;
19:
20: /**
21: * Encapsulates a SQL exception thrown during a broker action.
22: *
23: * @author Thomas Mahler
24: * @version $Id: PersistenceBrokerSQLException.java,v 1.8.2.2 2005/12/21 22:22:07 tomdz Exp $
25: */
26: public class PersistenceBrokerSQLException extends
27: PersistenceBrokerException {
28: private String sqlState = null;
29:
30: /**
31: * Creates a new exception instance.
32: */
33: public PersistenceBrokerSQLException() {
34: super ();
35: }
36:
37: /**
38: * Creates a new exception instance.
39: *
40: * @param cause The base exception
41: */
42: public PersistenceBrokerSQLException(SQLException cause) {
43: super (cause);
44: sqlState = cause.getSQLState();
45: }
46:
47: /**
48: * Creates a new exception instance.
49: *
50: * @param msg The exception message
51: */
52: public PersistenceBrokerSQLException(String msg) {
53: super (msg);
54: }
55:
56: /**
57: * Creates a new exception instance.
58: *
59: * @param msg The exception message
60: * @param cause The base exception
61: */
62: public PersistenceBrokerSQLException(String msg, SQLException cause) {
63: super (msg, cause);
64: sqlState = cause.getSQLState();
65: }
66:
67: /**
68: * Returns the SQL state of the underlying {@link java.sql.SQLException}.
69: *
70: * @return The SQL state
71: */
72: public String getSQLState() {
73: return sqlState;
74: }
75: }
|