【发布时间】:2022-12-20 17:04:26
【问题描述】:
我看到了如下代码。
public void insertSomething( SomeObj some ) {
// insert 1 row
int result = someMapper.insertSomething( some );
if( result != 1 ) {
throw new SomeException( "insertion failed" );
}
}
我很好奇if( result != 1 ) { ... }。
如果数据库无法插入某些内容,是否会引发数据库异常?
我是否必须删除此代码?
【问题讨论】: