Incorrect result size: expected 1, actual 0

HTTP Status 500 - Incorrect result size: expected 1, actual 0


type Exception report

message Incorrect result size: expected 1, actual 0

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
	org.springframework.dao.support.DataAccessUtils.requiredSingleResult(DataAccessUtils.java:71)
	org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:797)


原因出在jdbcTemplate去请求的语句上,

该语句它需要有一个值,但是并没有返回,返回值是0,所以会报错,简单调整即可,用list去承接,让对象去list里面取值即可


你可能感兴趣的:(Java,Spring,mysql)