Maven dependencies used all over JPA tutorials same. Please follow "Setting up Project" section to understand about project configuration.
persistence.xml and other code files reused from How to Persist an Entity in data base using JPA?
Each Sample application from download includes SQL file also.
Retrieving or Finding an Entity :
Once an entity in the database, Student student = entintyManager.find(Student.class, 1L); this line will retrieve student entity where identifier value is 1. This is equal to SELECT * FROM STUDENT WHERE ID=1;
what happens if the object has been removed or we supplied wrong id by accident? then the results will be simply null.
It’s just one line, but what we need to understand really is, Persistence transition or State of Student entity.