Commits

hani  committed 4d0663e

Fixed for non-generated keys

  • Participants
  • Parent commits 2059fda

Comments (0)

Files changed (1)

File src/java/com/opensymphony/workflow/spi/jdbc/JDBCWorkflowStore.java

                 log.debug("Executing SQL statement: " + sql);
             }
 
-            stmt = prepareStatementWithKeys(conn, sql, entryId);
+            if (generatedKeys) {
+                stmt = conn.prepareStatement(sql, new String[] {entryId});
+            } else {
+                stmt = conn.prepareStatement(sql);
+            }
 
             long id = 0;
 
             log.debug("Executing SQL statement: " + sql);
         }
 
-        PreparedStatement stmt = prepareStatementWithKeys(conn, sql, stepId);
+        PreparedStatement stmt = generatedKeys ? conn.prepareStatement(sql, new String[] {
+                stepId
+            }) : conn.prepareStatement(sql);
 
         long id = 0;
         int idxCorrection = 1;
         return rs.getLong(pkColumnName);
     }
 
-    private static PreparedStatement prepareStatementWithKeys(Connection conn, String sql, String pkColumnName) throws SQLException, StoreException {
+    private static PreparedStatement prepareStatementWithKeys(Connection conn, String sql, String pkColumnName) throws SQLException {
         return conn.prepareStatement(sql, new String[] {pkColumnName});
     }