You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "John D. Ament (JIRA)" <ji...@apache.org> on 2018/03/07 17:34:00 UTC
[jira] [Assigned] (DELTASPIKE-1324) @Transactional annotation at
method level doesn't override the one at class level any more
[ https://issues.apache.org/jira/browse/DELTASPIKE-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John D. Ament reassigned DELTASPIKE-1324:
-----------------------------------------
Assignee: John D. Ament
> @Transactional annotation at method level doesn't override the one at class level any more
> ------------------------------------------------------------------------------------------
>
> Key: DELTASPIKE-1324
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1324
> Project: DeltaSpike
> Issue Type: Bug
> Components: Data-Module
> Affects Versions: 1.8.1
> Reporter: Jens Berke
> Assignee: John D. Ament
> Priority: Major
>
> Hi. The behaviour of @Transactional has changed with 1.8.1:
> Until version 1.8.0 @Transactional annotations at method level overrode those at the class level. Like this:
> {code:java}
> @Transactional(readOnly = true)
> public class MyClass {
> public void doSomethingReadOnly()
> @Transactional
> public void writeSomething(){code}
> This stopped working with version 1.8.1 because the @Transactional annotation at method level seems to be ignored and the transaction for the method remains read-only. The cause is probably the change introduced with DELTASPIKE-940, where the following method was added to org.apache.deltaspike.jpa.impl.transaction.TransactionStrategyHelper:
> {code:java}
> EntityManagerMetadata createEntityManagerMetadata(InvocationContext context)
> {
> EntityManagerMetadata metadata = new EntityManagerMetadata();
> metadata.readFrom(context.getMethod(), beanManager);
> metadata.readFrom(context.getMethod().getDeclaringClass(), beanManager);
> return metadata;
> }{code}
> If first reads the data at method level and then at class level, which seems to be the wrong order. Swapping these lines would restore the correct behaviour:
> {code:java}
> metadata.readFrom(context.getMethod().getDeclaringClass(), beanManager);
> metadata.readFrom(context.getMethod(), beanManager);{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)