我在我的项目中使用了较新版本的Spring-boot,所以我没有使用findById (长id),而是使用了getOne(长id) (可选的findById对我不起作用)。我的"save new form“方法运行良好,SQL数据库为提交的表单(也称为代理)创建一个id。但是当编辑表单时,我不能访问现有的id,并且得到一个空错误。谁能在这里给我指个方向。是因为我使用了getOne方法,所以返回的结果是空的,
我正在尝试使用Spring创建一个基本的REST服务,该服务返回使用Hibernate从数据库创建的POJO,然后转换为JSON并返回到REST调用。这是我的代码:@Entitypublic class Person implements Serializable {
PersonRepository personRepository;
@GetMapping(&quo
我的CountryServiceImpl有一个问题,当我想要在CountryServiceImpl中实现方法findOne时,它告诉我“推断类型'S‘,因为类型参数'S’不在它的范围之内;应该扩展‘ua.com.store.entity.Country你能帮我解决这个问题吗。@Getter@NoArgsConstructorpublic class Country {
@GeneratedValue(strategy = Gener
在下面的示例中,我使用了spring引导、spring和spring数据。(id)替换为personRepo.getOne(id)并点击localhost:8080/perss/1时,会在浏览器中得到Could not write JSON: No serializer found(@PathVariable("id") long id) {
Person p1 = personRepo.findOne(