Note that there are some explanatory texts on larger screens.

plurals
  1. PO"No row with the given identifier exists" although it DOES exist
    primarykey
    data
    text
    <p>I am using Hibernate and getting </p> <blockquote> <p>Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [#271]</p> </blockquote> <p>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.</p> <p>Just because it could be a fault of the mapping:</p> <pre><code>public class ProblemClass implements Persistent { @ManyToOne(optional = false) private MyDbObject myDbObject; } public class MyDbObject implements Persistent { @OneToMany(mappedBy = "myDbObject") private List&lt;ProblemClass&gt; problemClasses; @ManyToOne(optional = false) private ThirdClass thirdClass; } </code></pre> <p>I have absolutely no clue even where to look at. Any hints highly appreciated!</p> <p>Just to clarify: The data was inserted in another RUN of the application. It is definitely in the database, as I can see it via an SQL-Query after the application terminated. And after THAT, i.e. when starting the application again, I get the error in the FIRST query of the database -- no deletion, no rollback involved.</p> <p>Addition: Because it was asked, here is the code to fetch the data:</p> <pre><code>public List&lt;ProblemClass&gt; getProblemClasses() { Query query = session.createQuery("from ProblemClass"); return query.list(); } </code></pre> <p>And just to make it complete, here is the generic code to insert it (before fetching in another RUN of the application):</p> <pre><code>public void save(Persistent persistent) { session.saveOrUpdate(persistent); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload