在 jpa 中更新对象时出现问题
我有 bean 用户
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Long id;
@Column(name = "name", nullable = false)
private String name;
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(name = "fk_program_rating")
private List<Rating> ratingList = new ArrayList<Rating>();
}
和
public class Rating extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
private Long id;
@ManyToOne()
@JoinColumn(name = "fk_program_rating", nullable = false)
@ForeignKey(name = "FK_prog_rate")
@OnDelete(action = OnDeleteAction.CASCADE)
private Program program;
}
当尝试更新给我异常时:当表评级有行时,无法通过反射获取字段值
错误 TransactionInterceptor:434 - 应用程序异常被提交异常 com.vodafone.visradio.dataaccess.exception.DataAccessException 覆盖:org.hibernate.PropertyAccessException:无法通过 com.vodafone.visradio.dataaccess.model.Rating 的反射获取器获取字段值。ID
关于这个问题的任何帮助
谢谢