I'm trying to read my previously committed data in
Код: Выделить всё
@TransactionEvenListenerКод: Выделить всё
REQUIRES_NEWКод: Выделить всё
@Component
class MyTransactionalDomainEventHandler {
private final MyRepository myRepository;
@TransactionalEventListener
@Transactional(transactionManager = "myChainedTransactionManager", propagation = Propagation.REQUIRES_NEW)
public void onMyDomainEvent(MyDomainEvent event) {
MyEntity myEntity = myRepository.findById(event.getEntityId()); //entity is inserted in transaction that cause to work this listener.
}
}
Код: Выделить всё
REQUIREDКод: Выделить всё
TransactionalEventListenerКод: Выделить всё
AFTER_COMMITИсточник: https://stackoverflow.com/questions/781 ... ntlistener
Мобильная версия