1. opensymphony
  2. osworkflow

Commits

hani  committed 3faa761

Fix for WF-386

  • Participants
  • Parent commits 88aada5
  • Branches default

Comments (0)

Files changed (2)

File src/etc/deployment/jdbc/mysql.sql

View file
  • Ignore whitespace
 	 ID bigint NOT NULL AUTO_INCREMENT,
 	 PRIMARY KEY (id)
  )TYPE=InnoDB;
+
+drop table if exists OS_ENTRYIDS;
+CREATE TABLE OS_ENTRYIDS
+(
+	 ID bigint NOT NULL AUTO_INCREMENT,
+	 PRIMARY KEY (id)
+ )TYPE=InnoDB;

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

View file
  • Ignore whitespace
 public class MySQLWorkflowStore extends JDBCWorkflowStore {
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private String _stepSequenceIncrement = null;
-    private String _stepSequenceRetrieve = null;
+    private String entrySequenceIncrement = null;
+    private String entrySequenceRetrieve = null;
+    private String stepSequenceIncrement = null;
+    private String stepSequenceRetrieve = null;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
     public void init(Map props) throws StoreException {
         super.init(props);
-        _stepSequenceIncrement = (String) props.get("step.sequence.increment");
-        _stepSequenceRetrieve = (String) props.get("step.sequence.retrieve");
+        stepSequenceIncrement = (String) props.get("step.sequence.increment");
+        stepSequenceRetrieve = (String) props.get("step.sequence.retrieve");
+        entrySequenceIncrement = (String) props.get("entry.sequence.increment");
+        entrySequenceRetrieve = (String) props.get("entry.sequence.retrieve");
+    }
+
+    protected long getNextEntrySequence(Connection c) throws SQLException {
+        PreparedStatement stmt = null;
+        ResultSet rset = null;
+
+        try {
+            stmt = c.prepareStatement(entrySequenceIncrement);
+            stmt.executeUpdate();
+            rset = stmt.executeQuery(entrySequenceRetrieve);
+
+            rset.next();
+
+            long id = rset.getLong(1);
+
+            return id;
+        } finally {
+            cleanup(null, stmt, rset);
+        }
     }
 
     protected long getNextStepSequence(Connection c) throws SQLException {
         ResultSet rset = null;
 
         try {
-            stmt = c.prepareStatement(_stepSequenceIncrement);
+            stmt = c.prepareStatement(stepSequenceIncrement);
             stmt.executeUpdate();
-            rset = stmt.executeQuery(_stepSequenceRetrieve);
+            rset = stmt.executeQuery(stepSequenceRetrieve);
 
             rset.next();