我正在为我的网络服务使用休眠。
我可以列出所有记录,但无法仅列出一条。
该表包含:
ID (VARCHAR) VALUE(BIT)
celiac 1
rate 1
suggestions 0
显示的错误是:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.pfc.restaurante.models.Device#id="xxxxxx"]
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
主要代码:
@JsonAutoDetect
@Entity
@Table(name = "SETTINGS")
public class Settings implements Serializable{
@Id
@Column(name="ID")
private String id;
@Column(name="VALUE", nullable=false)
private boolean value;
(...)
}
//////////////////7
@Controller
@RequestMapping("/settingsService")
public class SettingsServiceController {
@Autowired
SettingsService settingsService;
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody Settings find(@PathVariable("id") String id){
return settingsService.find(id);
}
(...)
}
我已经阅读过,这可能是因为数据库与我的实体不一致(一些 nullable = true 时不应该),但我已经检查过了,没有这样的事情。
有人可以帮帮我吗?
提前致谢!