You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2009/01/18 08:28:23 UTC

svn commit: r735394 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java

Author: dblevins
Date: Sat Jan 17 23:28:23 2009
New Revision: 735394

URL: http://svn.apache.org/viewvc?rev=735394&view=rev
Log:
Workaround for a TCK test that needs to be challenged.  

According to EJB 3.0 "4.4.4 Restrictions for Transactions" any remove methods from home or component interfaces must not be allowed if the bean instance is in a transaction.  Unfortunately, the Java EE 5 TCK expects has tests that ignore the restrictions in 4.4.4 and expect beans in transactions can be removed via their home or component interface.   The test to see if the bean instance implements javax.ejb.SessionBean is a workaround for passing the TCK while the tests in question can be challenged or the spec can be changed/updated.

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java?rev=735394&r1=735393&r2=735394&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java Sat Jan 17 23:28:23 2009
@@ -352,7 +352,17 @@
             InterfaceType interfaceType = deploymentInfo.getInterfaceType(callInterface);
             if (interfaceType.isComponent()) {
                 Instance instance = checkedOutInstances.get(primKey);
-                if (instance != null) {
+
+                /**
+                 * According to EJB 3.0 "4.4.4 Restrictions for Transactions" any remove methods
+                 * from home or component interfaces must not be allowed if the bean instance is
+                 * in a transaction.  Unfortunately, the Java EE 5 TCK has tests that ignore the
+                 * restrictions in 4.4.4 and expect beans in transactions can be removed via their
+                 * home or component interface.   The test to see if the bean instance implements
+                 * javax.ejb.SessionBean is a workaround for passing the TCK while the tests in
+                 * question can be challenged or the spec can be changed/updated.
+                 */
+                if (instance != null && instance.bean instanceof javax.ejb.SessionBean) {
                     throw new ApplicationException(new RemoveException("A stateful EJB enrolled in a transaction can not be removed"));
                 }
             }