You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2009/08/30 14:36:50 UTC

svn commit: r809324 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java

Author: lektran
Date: Sun Aug 30 12:36:49 2009
New Revision: 809324

URL: http://svn.apache.org/viewvc?rev=809324&view=rev
Log:
Fix problem reported by Jacques, the ResultSet API doesn't allow FORWARD_ONLY result sets to call the first() method even 
if the current position is beforeFirst or first, worked around it by having the EntityListIterator handle the
situation

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java?rev=809324&r1=809323&r2=809324&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java Sun Aug 30 12:36:49 2009
@@ -133,9 +133,17 @@
         }
     }
 
-    /** Sets the cursor position to last result; if result set is empty returns false */
+    /** Sets the cursor position to first result; if result set is empty returns false */
     public boolean first() throws GenericEntityException {
         try {
+            if (resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) {
+                if (resultSet.isFirst()) return true;
+
+                if (resultSet.isBeforeFirst()) {
+                    return resultSet.next(); 
+                }
+            }
+
             return resultSet.first();
         } catch (SQLException e) {
             if (!closed) {