码迷,mamicode.com
首页 > 其他好文 > 详细

主键冲突异常 DuplicateKeyException

时间:2016-08-06 08:37:31      阅读:1474      评论:0      收藏:0      [点我收藏+]

标签:

 

org.springframework.dao.DuplicateKeyException


Exception thrown when an attempt to insert or update data results in violation of an primary key or unique constraint. Note that this is not necessarily a purely relational concept; unique primary keys are required by most database types.

Author:
Thomas Risberg

代码片段

import org.springframework.dao.DuplicateKeyException;

try{
    someMapper.insert(someBean);
    //TODO something
}catch(DuplicateKeyException e){
    //TODO something else
}

 

主键冲突异常 DuplicateKeyException

标签:

原文地址:http://www.cnblogs.com/zno2/p/4538614.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!