1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
@Service
public class TourneeServiceImpl implements TourneeService {
@Autowired
private TourneeRepository tourneeRepository;
...
@Override
@Transactional(rollbackFor = {ServiceException.class,DataIntegrityViolationException.class})
public void modifierTournee(Long _tourneeId, String _intitule, Integer _intervalleGPS, String _commentaire) throws ServiceException,DataIntegrityViolationException {
Tournee tournee;
// Recherche de la tournee
tournee = tourneeRepository.findOne(_tourneeId);
if (tournee == null)
throw new ServiceException("La tournée n'existe pas.");
tournee.setIntitule(_intitule);
tournee.setIntervalleGPS(_intervalleGPS);
tournee.setCommentaire(_commentaire);
}// La modification est effective en BD lors du commit de la transaction |
Partager