我有一个简单的sql查询,它将版本递增1,并返回postgresql中的当前值,如:int version = jdbcTemplate.update(sqlString, new Object[] {id}); 当没有预期的时返回结果org.springframework.web.util.NestedServletException: R
但是它抛出了一个错误:
SELECT * FROM reply WHERE '{:tags}' @> array[2293,2294];
类org.springframework.dao.DataIntegrityViolationExceptionPreparedStatementCallback;
我们Spring开发人员知道,如果尝试删除具有其他关联实体的实体,就会引发DataIntegrityViolationException。我编写了一个既捕获EmptyResultDataAccessException异常又捕获DataIntegrityViolationException异常的delete方法,并为每种情况抛出自定义服务级异常throw new ResourceNotFoundException("Id not found " + id); // returns 40