According to the JavaDoc
EntityManagergetReference(Class<T> entityClass,Object primaryKey) wrote:
If the requested instance does not exist in the database, throws EntityNotFoundException when the instance state is first accessed. (The persistence provider runtime is permitted to throw EntityNotFoundException when getReference(java.lang.Class, java.lang.Object) is called.)
I confused with this. It says that the given exception is thrown when the instance state is first accessed. But within brackets it says that exception is thrown when the method is invoked. What a conflicting idea is this? When will the exception actually throwable?