This Exception occurs when Session.load() fails to select a row with the given primary key (identifier value). This exception might not be thrown when load() is called, even if there was no row on the database, because load() returns a proxy if possible. Applications should use Session.get() to test if a row or particular record exists in the database for particular primary key.
In this article, we are discussing the hibernate org.hibernate. ObjectNotFoundException: No row with the given identifier exists.
This exception is thrown when you try to load an entity in hibernate with session.load() method and entity is not found, which means instance of particular entity is not found in the current hibernate seesion context.
The correct way to solve this problem is to use session.get() method. Get method will return null if there is no record peresent for that entity or if record is not found.
One more solution is that call the session.load() in try catch block and handle exception accordingly.