"No row with the given identifier exists" although it DOES exist!
Posted
by roesslerj
on Stack Overflow
See other posts from Stack Overflow
or by roesslerj
Published on 2010-05-17T07:20:24Z
Indexed on
2010/05/17
7:50 UTC
Read the original article
Hit count: 217
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!
© Stack Overflow or respective owner