On May 29, 2007, at 3:19 PM, [EMAIL PROTECTED] wrote:

+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/ main/java/org/apache/openejb/core/stateful/StatefulContainer.java Tue May 29 15:19:40 2007
+
+ if (instanceManager.getBeanTransaction(callContext) != null) { + throw new ApplicationException(new RemoveException ("A stateful EJB enrolled in a transaction can not be removed"));
+            }
+
[...]
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/ main/java/org/apache/openejb/core/stateful/ StatefulInstanceManager.java Tue May 29 15:19:40 2007
@@ -116,6 +116,7 @@

public Transaction getBeanTransaction(ThreadContext callContext) throws OpenEJBException {
         BeanEntry entry = getBeanEntry(callContext);
+        if (entry == null) return null;
         return entry.beanTransaction;
     }
[...]
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/ test/java/org/apache/openejb/core/stateful/ StatefulSessionBeanTest.java Tue May 29 15:19:40 2007
@@ -101,7 +101,7 @@
     public static List<Call> calls = new ArrayList<Call>();

     public static enum Call {
- Constructor, SetSessionContext, EjbCreate, EjbPassivate1, EjbActivate1, BusinessMethod, EjbPassivate2, EjbActivate2, EjbRemove + Constructor, SetSessionContext, EjbCreate, EjbPassivate1, EjbActivate1, BusinessMethod, EjbPassivate2, EjbActivate2, EjbPassivate3, EjbActivate3, EjbRemove

We have some bad logic in here somewhere as we shouldn't need to activate a bean instance to check it's transaction state as beans with transactions can never be passivated.

Seems the getBeanTransaction method should just call 'getBeanIndex (callContext).get(primaryKey)' instead of 'getBeanEntry(callContext)' which has the side effect of activating/passivating an instance.


-David


Reply via email to