← Fidelity Interview Insights

Fidelity·Backend Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Technical phone screen for a backend role at Fidelity, heavy on Spring internals. One question but it went pretty deep, felt like they wanted to see if you actually understood the proxy mechanics or just memorized the annotation.

Questions Asked (1)

Q1

How do rollbackFor and noRollbackFor work in Spring's @Transactional, and what happens when both apply to the same exception?

Technical Trade-offsAPI & IntegrationsSystem Design
Author's notes

I knew the basics: Spring only rolls back on unchecked exceptions by default, and rollbackFor lets you extend that to checked ones.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the default rollback behavior of @Transactional, then define rollbackFor and noRollbackFor and how they customize rollback rules. Finally, address the conflict scenario by stating that noRollbackFor takes precedence and explain the underlying logic.

Pro tip: Mention that rollback rules are evaluated in order of specificity, and that noRollbackFor wins because it's more specific. Also, note that rollbackFor and noRollbackFor are inherited from the @Transactional annotation on the class or method, and that the most specific annotation wins.

1. Explain default rollback behavior

State that by default, Spring rolls back on unchecked exceptions (RuntimeException and Error) but not on checked exceptions.

2. Define rollbackFor and noRollbackFor

Describe that rollbackFor specifies exceptions that should trigger a rollback, while noRollbackFor specifies exceptions that should not trigger a rollback, overriding the default behavior.

3. Explain conflict resolution

When both apply to the same exception, noRollbackFor takes precedence, so the transaction will not roll back. This is because noRollbackFor is considered more specific.

4. Discuss practical implications

Highlight that this behavior is important for ensuring data consistency and that developers should be aware of the precedence to avoid unexpected rollbacks.

Key Points to Mention

  • Default rollback behavior: unchecked exceptions roll back, checked exceptions do not.
  • rollbackFor and noRollbackFor can be used to customize rollback rules.
  • When both apply to the same exception, noRollbackFor wins.
  • The precedence is due to noRollbackFor being more specific.
  • Rollback rules are evaluated in order of specificity.
  • This behavior is consistent with Spring's documentation and implementation.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.