DineshPandian
DineshPandian

Reputation: 49

when calling private method from @transactional public method, will the same transaction be used in private method or no transaction used

@Transactional
public class someClass implements someInterface {

    @override
    public void insertData() {    
        updateOtherTable();
    }

    private updateOtherTable() {
        //will this use above transaction or will not use any transaction?
    }
}

Upvotes: 2

Views: 1527

Answers (1)

cool
cool

Reputation: 1786

Spring proxies your public insertData method so everything in that method is executed in a transaction. So yes transaction is applied for your private method also.

Upvotes: 4

Related Questions