l3r8yJ / axio-test-task

2 stars 0 forks source link

Service Transactions should be in read-only by default #22

Open h1alexbel opened 1 year ago

h1alexbel commented 1 year ago

https://github.com/l3r8yJ/axio-test-task/blob/master/src/main/java/com/l3r8y/axiotesttask/service/impl/ContractServiceImpl.java#L43

should be:

@Transactional(readOnly=true)
class Service {

User user() {} // will be read only

@Transactional // will overridden to readOnly=false
void update() {}
}

Thus, read operations will get Tx with read only, and modify operations will get Tx with write