新手又犯错了。错题本又多一页。
原因很简单,打开了事务管理结果忘了关
em.getTransaction().begin();
T_Run_Config trc = em.find(T_Run_Config.class, "SCAN_LOG");
int newValue = Integer.valueOf(trc.getTheValue()) + dataSize;
trc.setTheValue(String.valueOf(newValue));
em.flush();
em.getTransaction().commit();
em.close();
emf.close();
就是漏了那句
em.getTransaction().commit();