Skip to content

Unexpected Retry Occurs Even After Catching Exception Inside @Transactional Method #118

@ausada-c

Description

@ausada-c

Environment:

Java Spring Boot

spring-boot-starter-parent version: 3.2.11

mq-jms-spring-boot-starter version: 3.3.3

Problem Description:
In my main function, I have added the annotation @transactional (org.springframework.transaction.annotation.Transactional).
Inside this main function, I call another service method that is also annotated with @transactional.

When an exception of type org.springframework.dao.DuplicateKeyException is thrown, even though I already have a try-catch block to catch this exception in the main function, the function still keeps retrying automatically.

Question:
Why does the function retry even after the exception has been caught in the main function?

Reference Video:
The following video demonstrates the behavior in my code.
https://github.com/user-attachments/assets/39a68851-aeac-4a72-8725-fb8c89eabc4c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions