org.hibernate.ObjectNotFoundException: No row with the given identifier exists
Problem:
This exception is thrown when you try to load an entity in hibernate with session.load() method and entity is not found. Exception trace look like this:
Hibernate: select student0_.Stu_ID as Stu1_0_0_, student0_.Stu_Name as Stu2_0_0_, student0_.Stu_Age as Stu3_0_0_ from Student student0_ where student0_.Stu_ID=?
Jul 27, 2013 8:03:50 PM org.hibernate.event.internal.DefaultLoadEventListener onLoad
INFO: HHH000327: Error performing load command : org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.ranga.mapping.Student#1]
Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.ranga.mapping.Student#1]
Solution:
If are sure if object exists then use load() method other wise use get() method. get() method always return null.
1 comments:
please change your hibernate configuration file as below:
create/update
Post a Comment