Preface
First of all:
It is not duplicate of Differences between requires_new and nested propagation in Spring transactions - I read it but I didn't found answer to my question
Question:
After reading topic I mentioned I understood that main difference between propagation levels in count of physical transactions:
2 db transactions- for REQUIRES_NEW
for outer and for inner method
1 db transaction - for NESTED
for outer and for inner method. It will not work if underlying database doesn't support savepoints
But looks like logic will be the same from my point if view.
How to understand which level to use in practise? Any use cases to understand it? Handy examples of behavioural differences?
P.S.
I suppose there are some visibility for other transactions differences because different transaction commit time.
P.S.2
Also I suppose there are performance difference:
@Transactional
public void outer(){
for(int i=0;i<100500;i++){
inner();
}
}
@Transactional
public void inner(){
//some logic
}
For that case NESTED will be better because of 1 long physical transaction instead of 100500+1