EntityNotFoundException in Hibernate Many To One mapping however data exist

前端 未结 9 1485
庸人自扰
庸人自扰 2020-12-13 12:39

I am getting javax.persistence.EntityNotFoundException error when I am trying to get User through Invoice object

invoice.getUser().getId()

Error is as follo

9条回答
  •  情歌与酒
    2020-12-13 12:52

    Not sure if that applies to your case.

    But I had a similar issue where I updated directly in the database table X and set a field null, but in java class the field was @NotNull.

    So when another class Y had a X object with ManyToOne, it wasn't able to load the entity because of the null value in the entity.

提交回复
热议问题