db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r420920 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
Date Tue, 11 Jul 2006 16:41:29 GMT
Author: arminw
Date: Tue Jul 11 09:41:28 2006
New Revision: 420920

URL: http://svn.apache.org/viewvc?rev=420920&view=rev
Log:
fix OJB-118, use new methods for better state detection

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java?rev=420920&r1=420919&r2=420920&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
Tue Jul 11 09:41:28 2006
@@ -22,9 +22,9 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.SystemUtils;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
-import org.apache.commons.lang.SystemUtils;
 import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.OJBRuntimeException;
 import org.apache.ojb.broker.OptimisticLockException;
@@ -42,7 +42,7 @@
 import org.apache.ojb.broker.util.logging.LoggerFactory;
 import org.apache.ojb.odmg.link.LinkEntry;
 import org.apache.ojb.odmg.link.LinkEntryMtoN;
-import org.apache.ojb.odmg.states.StateOldClean;
+import org.apache.ojb.odmg.states.ModificationState;
 import org.odmg.LockNotGrantedException;
 import org.odmg.ODMGRuntimeException;
 import org.odmg.Transaction;
@@ -151,14 +151,14 @@
             while(iter.hasNext())
             {
                 ObjectEnvelope mod = (ObjectEnvelope) iter.next();
-                if(!needsCommit || (mod.getModificationState() == StateOldClean.getInstance()
-                        || mod.getModificationState().isTransient()))
+                ModificationState state = mod.getModificationState();
+                if(!needsCommit || (state.isClean() && !state.isNew()) || state.isTransient())
                 {
                     // nothing to do
                 }
                 else
                 {
-                    mod.setModificationState(mod.getModificationState().markClean());
+                    mod.setModificationState(state.markClean());
                 }
             }
         }
@@ -298,8 +298,9 @@
         while(iter.hasNext())
         {
             ObjectEnvelope mod = (ObjectEnvelope) iter.next();
-            // only non transient objects should be performed
-            if(!mod.getModificationState().isTransient())
+            // transient and NewDelete objects must NOT performed
+            ModificationState state = mod.getModificationState();
+            if(!state.isTransient() && !(state.isNew() && state.isDelete()))
             {
                 mod.markReferenceElements(broker);
             }
@@ -320,8 +321,13 @@
         while(iter.hasNext())
         {
             mod = (ObjectEnvelope) iter.next();
+            // no need to lock new objects
+            if(mod.getModificationState().isNew())
+            {
+                needsCommit = true;
+            }
             // ignore transient objects
-            if(!mod.getModificationState().isTransient())
+            else if(!mod.getModificationState().isTransient())
             {
                 /*
                 now we check if all modified objects has a write lock. On insert of new



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message