Warum brauchen wir Annotation @Transactional in Springdata für Update-Funktion hinzufügen, während wir es nicht zum Erstellen, Entfernen, Löschen brauchen?Warum brauchen wir Annotation @Transactional in springdata für Update-Funktion hinzufügen?
Unten ist ein Beispiel.
@Service
public class PersonService
{
@Autowired
private PersonRepository personRepository;
@Transactional
public int updateEmail(String email,Integer id)
{
return personRepository.updateEmail(email, id);
}
}