[jboss-jira] [JBoss JIRA] (WFLY-11629) Transaction service isn't available when dynamically adding transactional annotation

Juan Gonzalez (Jira) issues at jboss.org
Tue Feb 5 03:46:01 EST 2019


    [ https://issues.jboss.org/browse/WFLY-11629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13691027#comment-13691027 ] 

Juan Gonzalez commented on WFLY-11629:
--------------------------------------

[~ochaloup] Payara server for example works perfectly fine. I know this behavior is on the edge of what should or not should be, but the workaround you said is very server-dependent and Java EE was made exactly to avoid these kind of things. I think users shouldn't be affected or even know this is an optimization and make this workaround themselves.

And about real world, yeah as I mentioned is not common use CDI to add dynamic annotations like this, but it is used in somehow "famous" Java EE 8 samples here: https://github.com/javaee-samples/javaee8-samples/tree/master/jpa/dynamic-tx, which is a repository gathering Java EE 8 examples to show new features.

> Transaction service isn't available when dynamically adding transactional annotation
> ------------------------------------------------------------------------------------
>
>                 Key: WFLY-11629
>                 URL: https://issues.jboss.org/browse/WFLY-11629
>             Project: WildFly
>          Issue Type: Bug
>          Components: Transactions
>    Affects Versions: 15.0.1.Final
>            Reporter: Juan Gonzalez
>            Assignee: Ondra Chaloupka
>            Priority: Major
>         Attachments: wildfly_dynamic_tx_reproducer.zip
>
>
> When adding dynamically a transactional annotation, transactional module isn't loaded, so transactions aren't available and throws this error:
> {noformat}
> javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform this operation (either use a transaction or extended persistence context)
> {noformat}
> I've attached a reproducer with a test in order to reproduce this. There you can see that there is a CDI producer that dynamically adds the annotation for transactions, that doesn't work.
> [~mkouba] found this could be an optimization for not loading JTS module: https://github.com/wildfly/wildfly/blob/master/transactions/src/main/java/org/jboss/as/txn/deployment/TransactionDependenciesProcessor.java#L74-L76 
> In order to execute tests:
> mvn clean test
> To execute test, passing in Payara:
> mvn clean test -Ppayara



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list