大家好,我正在将 SpringBoot 与 Mysql 一起使用。当我尝试显示信息时出现此错误
我的控制器中有以下代码:
query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2
org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2
Run Code Online (Sandbox Code Playgroud)
代码
@GetMapping("showdeveforma/{id}")
public String ShowDeveFormation(Model m , @PathVariable Long id)
{
Formation frm = frmreop.findById(id).get();
m.addAttribute("avis", srv.findByforma(frm));
return"ChefProjetAffichageAffectationDeveForma";
}
Run Code Online (Sandbox Code Playgroud)