Java Reference
In-Depth Information
<persistence-unit name="chapter04PU"
After declaring a JTA transaction type persistence unit, the developer can either
leave the transaction management to the server (by default, the container considers
a method as a transaction) or take control and define the transaction boundaries pro-
The following code is an example of a container-managed transaction:
public class StudentServiceCMT {
EntityManager em;
public void createStudent(){
Student student = new Student();
student.setBirthdate(new Date());
student.setId(""+ new Date().getTime());
student.setFirstname("CMT - FIRST NAME");
student.setLastname("CMT - Last name");
The following code is an example of bean-managed transaction:
Search WWH ::

Custom Search