You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Norbert Rieger <in...@web.de> on 2009/03/05 10:50:08 UTC

@TransactionAttribute on bean method level without any effect

Hi,

I'm using Apache Geronimo 2.1.3 with openejb 3.0 (and openjpa 1.0.3).

When defining the TransactionAttribute (REQUIRES_NEW) on bean level it 
works fine, current transaction (call from other bean) is resumed,
a new transaction is started and committed after leaving doAction ().

@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class MyBean implements MyBeanLocal {
   
    @PersistenceContext(unitName="MY_PU")
    private EntityManager em;

    int doAction () {
    ....
    }


But when defining the TransactionAttribute (REQUIRES_NEW) on method 
level (doAction) it seems that this has no effect :-(


@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class MyBean implements MyBeanLocal {
   
    @PersistenceContext(unitName="MY_PU")
    private EntityManager em;

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
     int doAction () {
    ....
    }

There is no new transaction.



What's wrong with my code in the second example (do I have to put the 
annotation on the local/remote interface) ?

Is this a bug in my definition or a bug in openEJB 3.0 ?

Thanks a lot for your help

Norbert