private void saveHistory(CDSHistoryVo histVo) throws StaleObjectException { histVo.setJobEndTime(new DateTime()); if(histVo.getErrorMessageIsNotNull() && histVo.getErrorMessage().length() > histVo.getErrorMessageMaxLength()) { histVo.setErrorMessage(histVo.getErrorMessage().substring(0, histVo.getErrorMessageMaxLength() - 1)); } histVo.validate(); DomainFactory domainFactory = getDomainFactory(); CDSHistory hist = CDSHistoryVoAssembler.extractCDSHistory(domainFactory, histVo); domainFactory.save(hist); }