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

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

I can't get this to work in WildFly 8.2.0. I've tried various combinations of 
TransactionStrategies and Transactional annotations (DeltaSpike vs. JTA), and 
there is always some situation that fails.

My use cases:


{code}
@Repository
@Dependent
// add suitable transaction annotation here
@EntityManagerConfig(entityManagerResolver = CoreEntityManagerResolver.class)
public abstract class FooDao extends AbstractEntityRepository<Foo, Long>
{code}

I'm injecting this DAO into
1) stateless session beans
2) singleton startup beans
3) plain old non-transactional CDI beans

I'm invoking methods of the injected DAO from each of these 3 types of classes.

In cases 1) and 2), DAO methods should join the transaction of the calling EJB. 
In case 3), each DAO method invocation should automagically be wrapped by a new 
JTA transaction.

I'm not sure if this is a configuration issue or a bug in the 
{{TransactionStategy}} implementations provided by DeltaSpike. I'd expect the 
{{EnvironmentAwareTransactionStrategy}} to cover this situation, but I'm 
getting an exception saying the my singleton startup bean must not access 
{{UserTransaction}}.

> 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