简体   繁体   中英

how to manually force commit @Transactional spring boot?

serviceA.save(x);

syncToOtherServiceWithAPI(x.id);

// otherservice 
//fetchA(x.id) - but still haven't got the newest data because before not committed

how to get newest/updated data on other service?

Technically no you cannot commit manually while using @Transactional, for this, you can check TransactionTemplate to do it programmatically.

If you are trying to commit transactionally inside your other transaction, then use @Transactional (propagation = Propagation.REQUIRES_NEW)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM