Код: Выделить всё
@Entity
public class SomeEntity {
// …
}
@Transactional(isolation = READ_COMMITED)
public void persistUniqueAndSendEmail() {
SomeEntity e = // …
// Persis the entity to Postgres with a unique constraint that may fail
// Once the entity is persisted send the notification email
}
Если да, то это будет означать, что электронное письмо можно отправить, но соответствующие изменения не сохранятся.
Подробнее здесь: https://stackoverflow.com/questions/781 ... ansactiona