---
# System prepended metadata

title: 'org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.persistence.EntityNotFoundException: Unable to find...'
tags: [Hibernate, EntityNotFoundException, NestedServletException, ManyToOne]

---

# org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.persistence.EntityNotFoundException: Unable to find...

###### tags: `EntityNotFoundException` `NestedServletException` `ManyToOne` `Hibernate`

若某 entity 所有的<B style="color:#F00">多對一</B>關聯<B style="color:#F00">皆為</B>**必要**或皆為**非必要**，Hibernate 在產生 SQL statement 時會以`INNER JOIN`進行多個 tables 的合併，如此有可能出現明明存在的 tuple 卻找不到的現象；試著檢視 DDL 以確認所有帶外鍵的 attributes 其 nullability 是否與 entity class 相符。

參考資料：[I tired to do something with JpaRepository But Can not find row with findById ,](https://stackoverflow.com/questions/57691085/i-tired-to-do-something-with-jparepository-but-can-not-find-row-with-findbyid#answer-57706378 "Stack Overflow")