I have the following code:
@Service
public class MyService implements IMyService {
@Inject
IAnotherService anotherService;
// injects go here
// some code
@Transactional(isolation=Isolation.SERIALIZABLE)
public Result myMethod() {
// stuff done here
return this.myPrivateMethod()
}
private Result myPrivateMethod() {
// stuff done here
// multiple DAO SAVE of anObject
anotherService.processSomething(anObject);
return result;
}
}
@Service
public class AnotherService implements IAnotherService {
// injections here
// other stuff
@Transactional(isolation=SERIALIZABLE)
public Result processSomething(Object anObject) {
// some code here
// multiple dao save
// manipulation of anObject
dao.save(anObject);
}
}
@Transactional
behavior propagate to myPrivateMethod even if it's private?.Runtime Exception
occurs on processSomething()
, and processSomething
is called from myPrivateMethod
, will myPrivateMethod
and myMethod
do rollback?. @Service
?. How can I do extract method and invoke multiple private methods inside a public service method within a @Transactional
context?.isolation=Isolation.SERIALIZABLE
option a good alternative to synchronized
methods?.I know this has been answered already but I'm still having doubts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With