KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > sql > SQLIntegrityConstraintViolationException


1 /*
2  * @(#)SQLIntegrityConstraintViolationException.java 1.5 06/07/10
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.sql;
9
10 /**
11  * The subclass of {@link SQLException} thrown when the SQLState class value is '<i>23</i>'. This indicates that an integrity
12  * constraint (foreign key, primary key or unique key) has been violated.
13  *
14  * @since 1.6
15  */

16 public class SQLIntegrityConstraintViolationException extends SQLNonTransientException JavaDoc {
17     
18     /**
19      * Constructs a <code>SQLIntegrityConstraintViolationException</code> object.
20          * The <code>reason</code>, <code>SQLState</code> are initialized
21          * to <code>null</code> and the vendor code is initialized to 0.
22          *
23          * The <code>cause</code> is not initialized, and may subsequently be
24          * initialized by a call to the
25          * {@link Throwable#initCause(java.lang.Throwable)} method.
26          * <p>
27      * @since 1.6
28          */

29     public SQLIntegrityConstraintViolationException() {
30         super();
31     }
32     
33     /**
34      * Constructs a <code>SQLIntegrityConstraintViolationException</code>
35          * with a given <code>reason</code>. The <code>SQLState</code>
36          * is initialized to <code>null</code> and the vender code is initialized
37          * to 0.
38          *
39          * The <code>cause</code> is not initialized, and may subsequently be
40          * initialized by a call to the
41          * {@link Throwable#initCause(java.lang.Throwable)} method.
42          * <p>
43      * @param reason a description of the exception
44      * @since 1.6
45          */

46     public SQLIntegrityConstraintViolationException(String JavaDoc reason) {
47         super(reason);
48     }
49     
50     /**
51      * Constructs a <code>SQLIntegrityConstraintViolationException</code>
52          * object with a given <code>reason</code> and <code>SQLState</code>.
53          *
54          * The <code>cause</code> is not initialized, and may subsequently be
55          * initialized by a call to the
56          * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
57          * is initialized to 0.
58          * <p>
59      * @param reason a description of the exception
60      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
61      * @since 1.6
62          */

63     public SQLIntegrityConstraintViolationException(String JavaDoc reason, String JavaDoc SQLState) {
64         super(reason,SQLState);
65     }
66     
67     /**
68      * Constructs a <code>SQLIntegrityConstraintViolationException</code> object
69          * with a given <code>reason</code>, <code>SQLState</code> and
70          * <code>vendorCode</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.
75          * <p>
76      * @param reason a description of the exception
77      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
78      * @param vendorCode a database vendor specific exception code
79      * @since 1.6
80          */

81     public SQLIntegrityConstraintViolationException(String JavaDoc reason, String JavaDoc SQLState, int vendorCode) {
82          super(reason,SQLState,vendorCode);
83     }
84     
85     /**
86          * Constructs an <code>SQLIntegrityConstraintViolationException</code> object with
87          * a given <code>cause</code>.
88      * The <code>SQLState</code> is initialized
89      * to <code>null</code> and the vendor code is initialized to 0.
90      * The <code>reason</code> is initialized to <code>null</code> if
91      * <code>cause==null</code> or to <code>cause.toString()</code> if
92      * <code>cause!=null</code>.
93          * <p>
94      * @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
95      * the cause is non-existent or unknown.
96      * @since 1.6
97          */

98     public SQLIntegrityConstraintViolationException(Throwable JavaDoc cause) {
99         super(cause);
100     }
101
102     /**
103      * Constructs a <code>SQLIntegrityConstraintViolationException</code> object
104      * with a given
105      * <code>reason</code> and <code>cause</code>.
106      * The <code>SQLState</code> is initialized to <code>null</code>
107      * and the vendor code is initialized to 0.
108      * <p>
109      * @param reason a description of the exception.
110      * @param cause the (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
111      * the cause is non-existent or unknown.
112      * @since 1.6
113      */

114     public SQLIntegrityConstraintViolationException(String JavaDoc reason, Throwable JavaDoc cause) {
115          super(reason,cause);
116     }
117     
118     /**
119      * Constructs a <code>SQLIntegrityConstraintViolationException</code> object
120      * with a given
121      * <code>reason</code>, <code>SQLState</code> and <code>cause</code>.
122      * The vendor code is initialized to 0.
123      * <p>
124      * @param reason a description of the exception.
125      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
126      * @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
127      * the cause is non-existent or unknown.
128      * @since 1.6
129      */

130     public SQLIntegrityConstraintViolationException(String JavaDoc reason, String JavaDoc SQLState, Throwable JavaDoc cause) {
131           super(reason,SQLState, cause);
132     }
133     
134     /**
135      * Constructs a <code>SQLIntegrityConstraintViolationException</code> object
136      * with a given
137      * <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
138      * and <code>cause</code>.
139      * <p>
140      * @param reason a description of the exception
141      * @param SQLState an XOPEN or SQL:2003 code identifying the exception
142      * @param vendorCode a database vendor-specific exception code
143      * @param cause the (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
144      * the cause is non-existent or unknown.
145      * @since 1.6
146      */

147     public SQLIntegrityConstraintViolationException(String JavaDoc reason, String JavaDoc SQLState, int vendorCode, Throwable JavaDoc cause) {
148           super(reason,SQLState,vendorCode,cause);
149     }
150     
151     private static final long serialVersionUID = 8033405298774849169L;
152 }
153
Popular Tags