Sorry again, it's late, now I can see it....
Norbert Rieger schrieb:
Hi David,
sorry for the delayed answer, I was off for some days.
In my configuration there are three beans: MasterDataDciBean calls
MasterDataSyncBean calls MasterDataRootBean
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.NEVER)
public class MasterDataDciBean implements MasterDataDciBeanRemote,
MasterDataDciBeanLocal {
@EJB(name="ejb/MasterDataSyncBean")
private MasterDataSyncBeanLocal mdBean ;
public MdOwnDciIf findOwn(Locale locale, OwnPkey pkey) {
return convert (mdBean.findOwn (locale, pkey)) ;
}
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.NEVER)
public class MasterDataSyncBean implements MasterDataSyncBeanRemote,
MasterDataSyncBeanLocal {
@EJB(name="ejb/MasterDataRootBean")
private MasterDataRootBeanLocal mdRootBean ;
public BizOwn findOwn(Locale locale, OwnPkey pkey) {
synchronized (.....)
{
return mdRootBean.findOwn (locale, pkey) ;
}
}
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class MasterDataRootBean implements MasterDataRootBeanLocal {
@PersistenceContext(unitName="MD_PU")
private EntityManager em;
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public BizOwn findOwn(Locale locale, OwnPkey pkey) {
....
}
This is what I can see in the debug logs:
MasterDataDciBean
19:47:14,109 DEBUG [attributes] Transaction Attribute: public
wms.masterdata.dciejbclient.iface.MdOwnDciIf
wms.masterdata.dciejb.bean.MasterDataDciBean.findOwn(java.util.Locale,wms.export.types.Pkeys$OwnPkey)
-- MasterDataDciBean : * :
wms.masterdata.dciejb.bean.MasterDataDciBean : *(*) Never
19:47:14,109 DEBUG [attributes] Transaction Attribute: public
wms.masterdata.dciejbclient.iface.MdOwnDciIf
wms.masterdata.dciejb.bean.MasterDataDciBean.findOwn(java.util.Locale,wms.export.types.BaseTypes$OwnIdent)
throws wms.export.exceptions.NotUniqueException -- MasterDataDciBean :
* : wms.masterdata.dciejb.bean.MasterDataDciBean : *(*) Never
MasterDataSyncBean
19:47:20,453 DEBUG [attributes] Transaction Attribute: public
wms.masterdata.internal.ejbclient.biz.base.BizOwn
wms.masterdata.internal.ejb.bean.MasterDataRootBean.findOwn(java.util.Locale,wms.export.types.BaseTypes$OwnIdent)
throws wms.export.exceptions.NotUniqueException -- MasterDataRootBean
: * : wms.masterdata.internal.ejb.bean.MasterDataRootBean : *(*) Required
19:47:20,453 DEBUG [attributes] Transaction Attribute: public
wms.masterdata.internal.ejbclient.biz.base.BizOwn
wms.masterdata.internal.ejb.bean.MasterDataRootBean.findOwn(java.util.Locale,wms.export.types.Pkeys$OwnPkey)
-- MasterDataRootBean : * :
wms.masterdata.internal.ejb.bean.MasterDataRootBean : *(*) Required
But there is nothing for MasterDataRootBean ?
MasterDataRootBean and MasterDataSyncBean are part of the same
ejb-jar, MasterDataDci is part of another ejb-jar. All three beans are
within the same ear.
Why is MasterDataRootBean not examined ? What could be a reason for
this ?
Thanks a lot.
Norbert
David Blevins schrieb:
On Mar 5, 2009, at 11:38 PM, Norbert Rieger wrote:
Hi David,
there are two things that made me think that there is no now
transaction:
a) geronimo log (log level INFO)
if I make the annotation on bean class level, I got logs like:
16:19:35,968 INFO [Transaction] TX RequiresNew: Suspended
transaction
org.apache.geronimo.transaction.manager.transactioni...@1c21ffe
16:19:35,968 INFO [Transaction] TX RequiresNew: Started transaction
org.apache.geronimo.transaction.manager.transactioni...@377dda
16:20:46,687 INFO [Transaction] TX RequiresNew: Committing
transaction
org.apache.geronimo.transaction.manager.transactioni...@377dda
16:20:46,859 INFO [Transaction] TX RequiresNew: Resuming
transaction
org.apache.geronimo.transaction.manager.transactioni...@1c21ffe
This lines are missing if the annotation is on bean method level
Just a followup to your offline response. I realized we never got
the debug log data. Before spending time creating a small app to
help us reproduce this, if you can get the log lines for the methods
in question that would be a much better next step.
With the 'OpenEJB.start.attributes' log category set to DEBUG, there
should be a bunch of lines in the log file that start with
"Transaction Attribute:" and list the full method and transaction
attribute assigned to that method.
If we could get that data it would be the biggest help.
-David
b) if the caller of the bean method rolls back it's transaction, the
updates done in doAction are also rolled back.
I think I've found the reason, but I'm not sure, whether this is a
bug or it's like defined in the specs.
If the bean method is called via remote interface from outside (the
jvm), e.g. remote client, a new transaction is started, that's ok.
In my case the bean method is called via local interface from
another bean:
CallerBean.doCall () [REQUIRES] => MyBean.doAction () [REQUIRES_NEW]
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class CallerBean implements CallerBeanRemote {
@EJB(name="ejb/MyBean")
private MyBeanLocal myBean ;
int doCall () {
....
int hlp = myBean.doAction () ; // call myBean via local
iface, should start new transaction, but does not.
...
}
Do the call via local interface not look at the method's
TransactionAttribute, but the bean class' TransactionAttribute ?
Thanks a lot.
Norbert
David Blevins schrieb:
Hi Norbert,
If you can give some details on how you are determining that there
is no new transaction that'd be great.
We do log all the transaction attributes for each method (i.e. the
final values after defaults and overriding) on the log category
'OpenEJB.start.attributes' on the DEBUG level. If you can turn
that on (post to u...@geronimo if you need help with that) and post
the attributes for the methods in question that would also be great.
-David
On Mar 5, 2009, at 1:59 AM, Norbert Rieger wrote:
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