Java Reference
In-Depth Information
em.persist(student);//save the student
em.getTransaction().commit(); // commit
transaction
Student std = em.find(Student.class,
student.getId());
//find student
System.out.println("ID : "+std.getId()+",last
name : "+std.getLastname());
em.getTransaction().begin();//begin
transaction
std.setLastname("NGANBEL");//Update student's
last name
em.getTransaction().commit(); // commit
transaction
std = em.find(Student.class,
student.getId());//find student
System.out.println("ID : "+std.getId()+",last
name : "+std.getLastname());
em.getTransaction().begin();//begin
transaction
em.remove(std);//remove student
em.getTransaction().commit(); // commit
transaction
}
The latest improvements of JPA 2.1 in action
Since its last version (JPA 2.0), the JPA Specification has had many enhancements.
The most important enhancements are in the following features: persistence context
synchronization, Entities, JPQL , Criteria API , and Data Definition Language
( DDL ) generation.
Search WWH ::




Custom Search