db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r500494 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/io: DataToDatabaseSink.java WaitingObject.java
Date Sat, 27 Jan 2007 07:05:45 GMT
Author: tomdz
Date: Fri Jan 26 23:05:45 2007
New Revision: 500494

URL: http://svn.apache.org/viewvc?view=rev&rev=500494
Log:
Fixed bug with inserting data into a table with multiple self-references

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataToDatabaseSink.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/WaitingObject.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataToDatabaseSink.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataToDatabaseSink.java?view=diff&rev=500494&r1=500493&r2=500494
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataToDatabaseSink.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataToDatabaseSink.java Fri Jan 26 23:05:45
2007
@@ -290,7 +290,7 @@
 
         if (_ensureFkOrder && (table.getForeignKeyCount() > 0))
         {
-            WaitingObject waitingObj = new WaitingObject(bean);
+            WaitingObject waitingObj = new WaitingObject(bean, origIdentity);
 
             for (int idx = 0; idx < table.getForeignKeyCount(); idx++)
             {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/WaitingObject.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/WaitingObject.java?view=diff&rev=500494&r1=500493&r2=500494
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/WaitingObject.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/WaitingObject.java Fri Jan 26 23:05:45
2007
@@ -19,11 +19,10 @@
  * under the License.
  */
 
-import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
 
 import org.apache.commons.beanutils.DynaBean;
+import org.apache.commons.collections.set.ListOrderedSet;
 
 /**
  * Represents an object waiting for insertion into the database. Is used by the
@@ -36,17 +35,21 @@
 {
     /** The object that is waiting for insertion. */
     private DynaBean _obj;
+    /** The original identity of the waiting object. */
+    private Identity _objIdentity;
     /** The identities of the waited-for objects. */
-    private List _waitedForIdentites = new ArrayList();
+    private ListOrderedSet _waitedForIdentites = new ListOrderedSet();
 
     /**
      * Creates a new <code>WaitingObject</code> instance for the given object.
      * 
-     * @param obj The object that is waiting
+     * @param obj         The object that is waiting
+     * @param objIdentity The (original) identity of the object
      */
-    public WaitingObject(DynaBean obj)
+    public WaitingObject(DynaBean obj, Identity objIdentity)
     {
-        _obj = obj;
+        _obj         = obj;
+        _objIdentity = objIdentity;
     }
 
     /**
@@ -107,5 +110,18 @@
     public boolean hasPendingFKs()
     {
         return !_waitedForIdentites.isEmpty();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        StringBuffer result = new StringBuffer();
+
+        result.append(_objIdentity);
+        result.append(" waiting for ");
+        result.append(_waitedForIdentites.toString());
+        return result.toString();
     }
 }



Mime
View raw message