Java Reference
In-Depth Information
Then, we need to specify the project and package for our JPA controller classes.
After clicking on Finish , our JPA controller class is successfully generated,
as shown here:
package com.ensode.jpaweb;
//imports omitted
public class CustomerJpaController implements Serializable {
public CustomerJpaController(UserTransaction utx,
EntityManagerFactory emf) {
this.utx = utx;
this.emf = emf;
private UserTransaction utx = null;
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
public void create(Customer customer) throws
RollbackFailureException, Exception {
EntityManager em = null;
try {
Search WWH ::

Custom Search