Resolved: “org.hibernate.ObjectNotFoundException: No row with the given identifier exists” but it does exists
Error: “org.hibernate.ObjectNotFoundException: No row with the given identifier exists” but it does exists.
I was facing this issue with my current project. There might be 2 possible reasons to occur this error.
Root Causes:
1. Whene there is relationship between two tables in the database, the main entity may not exists in the database, You can check it with session.get() method whether it is there or not.
2. There will be broken relationships. When entity X owns a relation with entity Y, when entity B is deleted while the Foreign Key(FK) in entity X is left untouched. So whenever Hibernate tries to load the link X->Y this error occurs.
My application root cause is 2. What is yours???
I was facing this issue with my current project. There might be 2 possible reasons to occur this error.
Root Causes:
1. Whene there is relationship between two tables in the database, the main entity may not exists in the database, You can check it with session.get() method whether it is there or not.
2. There will be broken relationships. When entity X owns a relation with entity Y, when entity B is deleted while the Foreign Key(FK) in entity X is left untouched. So whenever Hibernate tries to load the link X->Y this error occurs.
My application root cause is 2. What is yours???
Comments
Post a Comment