Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // what will return getUserCount() if called after processTransaction()
- @Service
- public class TransactionalPuzzlerService {
- @Autowired
- private UserRepository userRepository;
- @Transactional
- public void performTransactionalOperation() {
- userRepository.deleteAll();
- throw new RuntimeException("Oops! Something went wrong.");
- }
- public void processTransaction() {
- performTransactionalOperation();
- }
- public int getUserCount() {
- return userRepository.count();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement