- java.lang.Object
 -  
      
- java.lang.Throwable
 -  
        
- java.lang.Exception
 -  
          
- java.sql.SQLException
 -  
            
- java.sql.SQLNonTransientException
 -  
              
- java.sql.SQLIntegrityConstraintViolationException
 
 
 
 
 
 
-  
       
- 实现的所有接口
 -  
         
Serializable,Iterable<Throwable> 
public class SQLIntegrityConstraintViolationException extends SQLNonTransientException
当SQLState类值为“ 23 ”或在供应商指定的条件下时,抛出SQLException的子类。 这表示违反了完整性约束(外键,主键或唯一键)。异常可能引发此异常的供应商指定条件,请参阅驱动程序供应商文档。- 从以下版本开始:
 - 1.6
 - 另请参见:
 - Serialized Form
 
 
-  
        
       
-  
             
构造方法摘要
构造方法 构造器 描述 SQLIntegrityConstraintViolationException()构造一个SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason)构造一个SQLIntegrityConstraintViolationException给定的reason。SQLIntegrityConstraintViolationException(String reason, String SQLState)使用给定的reason和SQLState构造SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode)构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState和vendorCode。SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause)构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState,vendorCode和cause。SQLIntegrityConstraintViolationException(String reason, String SQLState, Throwable cause)构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState和cause。SQLIntegrityConstraintViolationException(String reason, Throwable cause)使用给定的reason和cause构造一个SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(Throwable cause)使用给定的cause构造一个SQLIntegrityConstraintViolationException对象。 
-  
             
方法摘要
-  
               
声明方法的类 java.sql.SQLException
getErrorCode, getNextException, getSQLState, iterator, setNextException 
-  
               
声明方法的类 java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 
-  
               
声明方法的类 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
-  
               
声明方法的接口 java.lang.Iterable
forEach, spliterator 
 -  
               
 
 -  
             
 
-  
        
       
-  
             
构造方法详细信息
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException()
构造一个SQLIntegrityConstraintViolationException对象。 的reason,SQLState被初始化为null,供应商代码被初始化为0。cause没有初始化,随后可以通过向一个呼叫进行初始化Throwable.initCause(java.lang.Throwable)方法。- 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason)
构造一个SQLIntegrityConstraintViolationException给定的reason。SQLState初始化为null,供应商代码初始化为cause未初始化,随后可通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。- 参数
 -  
              
reason- 异常的描述 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, String SQLState)
使用给定的reason和SQLState构造一个SQLIntegrityConstraintViolationException对象。cause未初始化,随后可通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。 供应商代码初始化为0。- 参数
 -  
              
reason- 异常的描述 -  
              
SQLState- 标识异常的XOPEN或SQL:2003代码 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode)
构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState和vendorCode。cause未初始化,随后可通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。- 参数
 -  
              
reason- 异常的描述 -  
              
SQLState- 标识异常的XOPEN或SQL:2003代码 -  
              
vendorCode- 特定于数据库供应商的异常代码 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(Throwable cause)
使用给定的cause构造一个SQLIntegrityConstraintViolationException对象。SQLState初始化为null,供应商代码初始化为0.reason初始化为null如果为cause==null或cause.toString()如果为cause!=null。- 参数
 -  
              
cause- 此SQLException的基本原因(保存以供以后通过getCause()方法检索); 可以为空,表示原因不存在或未知。 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, Throwable cause)
使用给定的reason和cause构造一个SQLIntegrityConstraintViolationException对象。SQLState初始化为null,供应商代码初始化为0。- 参数
 -  
              
reason- 异常的描述。 -  
              
cause- (保存以供以后通过getCause()方法检索); 可以为空,表示原因不存在或未知。 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, String SQLState, Throwable cause)
构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState和cause。 供应商代码初始化为0。- 参数
 -  
              
reason- 异常的描述。 -  
              
SQLState- 标识异常的XOPEN或SQL:2003代码 -  
              
cause- 此SQLException的基本原因(保存以供以后通过getCause()方法检索); 可以为空,表示原因不存在或未知。 - 从以下版本开始:
 - 1.6
 
 
-  
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause)
构造一个SQLIntegrityConstraintViolationException与给定对象reason,SQLState,vendorCode和cause。- 参数
 -  
              
reason- 异常的描述 -  
              
SQLState- 标识异常的XOPEN或SQL:2003代码 -  
              
vendorCode- 特定于数据库供应商的异常代码 -  
              
cause- (保存以供以后通过getCause()方法检索); 可以为空,表示原因不存在或未知。 - 从以下版本开始:
 - 1.6
 
 
 -  
 
 -