Spring 使用一对多双向时找不到实体找不到异常
使用邮递员发布数据或运行程序时,遇到以下错误: 找不到id为1的com.example.entity.Product;嵌套异常为javax.persistence.EntityNotFoundException:找不到id为1的com.example.entity.Product 下面是父类:Spring 使用一对多双向时找不到实体找不到异常,spring,hibernate,spring-boot,spring-data,Spring,Hibernate,Spring Boot,Spring Data,使用邮递员发布数据或运行程序时,遇到以下错误: 找不到id为1的com.example.entity.Product;嵌套异常为javax.persistence.EntityNotFoundException:找不到id为1的com.example.entity.Product 下面是父类: @实体 公共类客户{ @身份证 @生成值 私有整数客户Id; 私有字符串cust_name; 私人城市; @OneToMany(mappedBy=“客户”) 私人上市产品; } 儿童班: @实体 公共类产
@实体
公共类客户{
@身份证
@生成值
私有整数客户Id;
私有字符串cust_name;
私人城市;
@OneToMany(mappedBy=“客户”)
私人上市产品;
}
儿童班:
@实体
公共类产品{
@身份证
私有整数pid;
私有字符串pname;
@manytone(fetch=FetchType.LAZY)
@NotFound(action=NotFoundAction.IGNORE)
@JoinColumn(name=“fk\u cust\u id”)
私人客户;
}
@NotFound(action=NotFoundAction.IGNORE)
导致对@manytone(fetch=FetchType.LAZY)
字段的急切加载 您使用什么hibernate版本?Spring boot with data jpa,Spring boot-2.0.1.RELEASE