@Transactional(readOnly = false) public void save(TestDataMain testDataMain) { super.save(testDataMain); for (TestDataChild testDataChild : testDataMain.getTestDataChildList()) { if (testDataChild.getId() == null) { continue; } if (TestDataChild.DEL_FLAG_NORMAL.equals(testDataChild.getDelFlag())) { if (StringUtils.isBlank(testDataChild.getId())) { testDataChild.setTestDataMain(testDataMain); testDataChild.preInsert(); testDataChildDao.insert(testDataChild); } else { testDataChild.preUpdate(); testDataChildDao.update(testDataChild); } } else { testDataChildDao.delete(testDataChild); } } }
@Transactional(readOnly = false) public void delete(TestDataMain testDataMain) { super.delete(testDataMain); testDataChildDao.delete(new TestDataChild(testDataMain)); }