//如果你需要真正插入数据库,将Rollback设为false
//@Rollback(false)
public void crudEntity() {
// 保存请假
Leave leave = new Leave();
leave.setApplyTime(new Date());
leave.setStartTime(new jodd.datetime.JDateTime("2012-05-22").convertToSqlDate());
leave.setEndTime(new jodd.datetime.JDateTime("2012-05-23").convertToSqlDate());
leave.setLeaveType("公休");
leave.setUserId("kafeitu");
leave.setReason("no reason");
entityDao.save(leave);
em.flush();
// 获取用户
leave = entityDao.findOne(leave.getId());
assertNotNull(leave);
// 删除请假
entityDao.delete(leave);
em.flush();
// 获取用户
leave = entityDao.findOne(leave.getId());
assertNull(leave);
}