tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r526234 - in /incubator/openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java
Date Fri, 06 Apr 2007 17:39:32 GMT
Author: dain
Date: Fri Apr  6 10:39:31 2007
New Revision: 526234

URL: http://svn.apache.org/viewvc?view=rev&rev=526234
Log:
A NoSuchEntityException from a BMP ejbLoad must be converted to a NoSuchObjectException
Entity bean proxies should not be invalidated since an entity bean can seamlessly reattach
to a new instance loaded from the database

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
    incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java?view=diff&rev=526234&r1=526233&r2=526234
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
Fri Apr  6 10:39:31 2007
@@ -30,12 +30,14 @@
 import org.apache.openejb.util.Stack;
 
 import javax.ejb.EntityBean;
+import javax.ejb.NoSuchEntityException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.Synchronization;
 import javax.transaction.SystemException;
 import java.util.HashMap;
 import java.util.Hashtable;
+import java.rmi.NoSuchObjectException;
 
 public class EntityInstanceManager {
 
@@ -113,7 +115,7 @@
                     * its likely that the application server would have already made the
reference invalid, but this bit of
                     * code is an extra precaution.
                     */
-                    throw new org.apache.openejb.InvalidateReferenceException(new javax.ejb.NoSuchEntityException("Entity
not found: " + primaryKey));
+                    throw new org.apache.openejb.InvalidateReferenceException(new NoSuchObjectException("Entity
not found: " + primaryKey));
                 } else if (callContext.getCurrentOperation() == Operation.REMOVE) {
                     /*
                     *  To avoid calling ejbStore( ) on a bean that after its removed, we
can not delegate
@@ -179,6 +181,8 @@
                 BaseContext.State[] originalStates = callContext.setCurrentAllowedStates(EntityContext.getStates());
                 try {
                     bean.ejbLoad();
+                } catch (NoSuchEntityException e) {
+                    throw new org.apache.openejb.InvalidateReferenceException(new NoSuchObjectException("Entity
not found: " + primaryKey).initCause(e));
                 } catch (Exception e) {
                     logger.error("Exception encountered during ejbLoad():", e);
 

Modified: incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java?view=diff&rev=526234&r1=526233&r2=526234
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EntityEJBObjectHandler.java
Fri Apr  6 10:39:31 2007
@@ -79,4 +79,9 @@
         }
     }
 
+    protected void invalidateReference() {
+        // entity bean object references should not be invalidated since they
+        // will automatically hook up to a new instance of the bean using the
+        // primary key (we will load a new instance from the db)
+    }
 }



Mime
View raw message