It turns out there is a bit of “gatch”, which I forgot ...
From spring docs
( ) 'external' - . , "", , , , @Transactional!
, .
-, ...
@Autowired
private ApplicationContext applicationContext;
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void doSomeWork(){
Entity = entity = dao.loadEntity();
...
try {
dao.saveEntity(entity);
}
catch(StaleObjectStateException sose){
dao.flush(entity);
applicationContext.getBean(this.getClass()).doSomeWork();
}
}