"No row with the given identifier exists" although it DOES exist!
- by roesslerj
Hello all!
I am using Hibernate and getting
Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [<MyDbObject>#271]
What is pretty weird about this error is, that the object with the given id exists in the database. I inserted the problematic record in another run of the application. If I access it in the same run (i.e. same hibernate session) there seem to be no problems retrieving the data.
Just because it could be a fault of the mapping:
public class ProblemClass {
@ManyToOne(optional = false)
private MyDbObject myDbObject;
}
public class MyDbObject {
@OneToMany(mappedBy = "myDbObject")
private List<ProblemClass> problemClasses;
}
I have absolutely no clue even where to look at. Any hints highly appreciated!