/*** 更新客户的操作* merge(Object)*/@Testpublic void testUpdate(){//1.通过工具类获取entityManagerEntityManager entityManager = JpaUtils.getEntityManager();//2.开启事务EntityTransaction transaction = entityManager.getTransaction();transaction.begin();//3.增删改查 -- 更新操作//i.查询客户Customer customer = entityManager.find(Customer.class, 1l);//ii.更新客户customer.setCustIndustry("线上营销");entityManager.merge(customer);//4.提交事务transaction.commit();//5.释放资源entityManager.close();}
