[ 
https://issues.apache.org/jira/browse/DELTASPIKE-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14355664#comment-14355664
 ] 

Harald Wellmann commented on DELTASPIKE-420:
--------------------------------------------

I think the problem is caused by the Partial Bean {{ManualInvocationHandler}}. 
I can't say I understand its design by reading the source code, but throwing an 
exception to mark the end of the interceptor chain looks a bit suspicious to me.

Using this with the {{@javax.transaction.Transactional}} interceptor 
(implemented by 
{{com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired}} in 
WildFly), the {{ProceedOriginalMethodException}} thrown by DeltaSpike is caught 
by the interceptor which then rolls back the current transaction. This explains 
why my transactional repositories don't work.

To demonstrate this issue: 
{{org.apache.deltaspike.test.core.api.partialbean.uc007.MethodLevelInterceptorTest}}
 will fail after modifying
{{org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl}}
 like this:

{code}
@Interceptor
@CustomInterceptor
public class CustomInterceptorImpl implements Serializable
{
    @Inject private CustomInterceptorState interceptionStateHolder;

    @AroundInvoke
    public Object interceptIt(InvocationContext invocationContext) throws 
Exception
    {
        interceptionStateHolder.setIntercepted(true);
        try {
            return invocationContext.proceed();
        }
        catch (Exception exc) {
            System.out.println("Exception in interceptor!");
        }
        return null;
    }
}
{code}



> Transactional repositories
> --------------------------
>
>                 Key: DELTASPIKE-420
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-420
>             Project: DeltaSpike
>          Issue Type: New Feature
>          Components: Data-Module
>    Affects Versions: 0.5
>            Reporter: Harald Wellmann
>            Assignee: Jozef Hartinger
>             Fix For: 1.3.0
>
>         Attachments: DELTASPIKE-420_spi.patch
>
>
> It's nice to get semi-automatic repositories from DeltaSpike Data, but these 
> repositories would be even more fun if they were transactional, not 
> necessarily by default, but at least by simple configuration.
> Possible approaches:
> 1) Add @Transactional to an abstract repository class, i.e. 
> javax.transaction.Transactional in Java EE 7, or 
> org.apache.deltaspike.jpa.api.transaction.Transactional otherwise.
> Currently, this does not work due to DELTASPIKE-419.
> 2) Make it easy to override the @Repository binding or the query handler, to 
> add transactional behaviour.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to