EntityNotFoundException in Hibernate Many To One mapping however data exist

前端 未结 9 1498
庸人自扰
庸人自扰 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:50

    Use @NotFound(action = NotFoundAction.IGNORE) in case it's parent not exist

    By using cascade=CascadeType.ALL it will delete it's parent entity

提交回复
热议问题