原文:JPA報錯 javax.persistence.EntityNotFoundException: Unable to find XX類 with id xx問題

原因: 無論是 OneToOne 還是 ManyToOne,出現這個原因都是因為子表 被關聯表 中沒有主表 關聯表 中ID所對應的記錄。 解決辦法: . 檢查為什么子表中沒有主表中ID對應的記錄 . 如果子表中沒有主表ID對應的記錄也可以正常加載數據,那么需要在主表字段上加一個 NotFound Annotation。示例如下: OneToOne optional true JoinColumn ...

2020-02-22 16:14 0 872 推薦指數:

查看詳情

解決javax.persistence.EntityNotFoundException: Unable to find

原:          javax.persistence.EntityNotFoundException: Unable to find 原因: 無論是@OneToOne 還是@ManyToOne,出現這個原因都是因為子表(被關聯表)中沒有主表(關聯表)中ID所對應的記錄。 解決 ...

Wed Jul 03 18:19:00 CST 2019 0 542
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM