try { java.lang.reflect.Method[] methods = EntityManager.class.getDeclaredMethods(); Customer cust = new Customer(); cust.setName(name); em.persist(cust); return cust.getId(); } catch (Exception e) { e.printStackTrace(); } return -1;
return em.find(Customer.class, id);