You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Frank Jung (Jira)" <ji...@apache.org> on 2020/10/09 12:14:00 UTC

[jira] [Updated] (TOMEE-2907) Transaction not marked RollbackOnly when @Transactional annotated via @Stereotype

     [ https://issues.apache.org/jira/browse/TOMEE-2907?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Jung updated TOMEE-2907:
------------------------------
    Description: 
When calling a bean method (or its class) annotated with @Transactional, the transaction is marked RollbackOnly if a RuntimeException is thrown from within the method.

This is not working when wrapping @Transactional into a @Stereotype and using this to mark as transactional.

Tiny sample project to demonstrate the problem will be attached - call the following URLs after deployment:

[1] [http://localhost:8080/TransStereoDemo/demo/success|http://localhost:8080/TransStereoDemo/demo/fail]

[2] [http://localhost:8080/TransStereoDemo/demo/fail]

[3] [http://localhost:8080/TransStereoDemo/demo/success2|http://localhost:8080/TransStereoDemo/demo/fail]

[4] [http://localhost:8080/TransStereoDemo/demo/fail2]

All above calls will output "COMMIT" or "ROLLBACK" depending on the transaction state.

[2] will correctly result in "ROLLBACK" (@Transactional annotated directly) while [4] gives "COMMIT" (@Stereotype containing @Transactional is used for annotation)

  was:
When annotating a bean method (or its class) with @Transactional, the transaction is marked RollbackOnly if a RuntimeException is thrown.

This is not working when wrapping @Transactional into a @Stereotype and using this to mark as transactional.

Tiny sample project to demonstrate the problem will be attached - call the following URLs after deployment:

[1] [http://localhost:8080/TransStereoDemo/demo/success|http://localhost:8080/TransStereoDemo/demo/fail]

[2] [http://localhost:8080/TransStereoDemo/demo/fail]

[3] [http://localhost:8080/TransStereoDemo/demo/success2|http://localhost:8080/TransStereoDemo/demo/fail]

[4] [http://localhost:8080/TransStereoDemo/demo/fail2]

All above calls will output "COMMIT" or "ROLLBACK" depending on the transaction state.

[2] will correctly result in "ROLLBACK" (@Transactional annotated directly) while [4] gives "COMMIT" (@Stereotype containing @Transactional is used for annotation)


> Transaction not marked RollbackOnly when @Transactional annotated via @Stereotype
> ---------------------------------------------------------------------------------
>
>                 Key: TOMEE-2907
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2907
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 8.0.4
>            Reporter: Frank Jung
>            Priority: Major
>         Attachments: TransStereoDemo.zip
>
>
> When calling a bean method (or its class) annotated with @Transactional, the transaction is marked RollbackOnly if a RuntimeException is thrown from within the method.
> This is not working when wrapping @Transactional into a @Stereotype and using this to mark as transactional.
> Tiny sample project to demonstrate the problem will be attached - call the following URLs after deployment:
> [1] [http://localhost:8080/TransStereoDemo/demo/success|http://localhost:8080/TransStereoDemo/demo/fail]
> [2] [http://localhost:8080/TransStereoDemo/demo/fail]
> [3] [http://localhost:8080/TransStereoDemo/demo/success2|http://localhost:8080/TransStereoDemo/demo/fail]
> [4] [http://localhost:8080/TransStereoDemo/demo/fail2]
> All above calls will output "COMMIT" or "ROLLBACK" depending on the transaction state.
> [2] will correctly result in "ROLLBACK" (@Transactional annotated directly) while [4] gives "COMMIT" (@Stereotype containing @Transactional is used for annotation)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)