Even though late to the party I would also like to point you to another possible cause of this failure. It took me many hours to figure this out when I encountered the very same exception javax.persistence.EntityNotFoundException
. That's why I am happy to share the result of my investigation. The database user had permissions to access the primary table (First
in the original post), but not the child table (Second
in the original post). Using a database browser logged in as the same database user my JPA application has been using to access the database, SELECT * FROM SECOND;
always yielded the empty result set, even though I have know that it has actually contained several data. After having granted the necessary permissions the the database user the EntityNotFoundException
vanished.