1 5 package com.opensymphony.workflow.spi.jdbc; 6 7 import com.opensymphony.workflow.StoreException; 8 9 import java.sql.Connection ; 10 import java.sql.PreparedStatement ; 11 import java.sql.ResultSet ; 12 import java.sql.SQLException ; 13 14 import java.util.Map ; 15 16 17 21 public class MySQLWorkflowStore extends JDBCWorkflowStore { 22 24 private String _stepSequenceIncrement = null; 25 private String _stepSequenceRetrieve = null; 26 27 29 public void init(Map props) throws StoreException { 30 super.init(props); 31 _stepSequenceIncrement = (String ) props.get("step.sequence.increment"); 32 _stepSequenceRetrieve = (String ) props.get("step.sequence.retrieve"); 33 } 34 35 protected long getNextStepSequence(Connection c) throws SQLException { 36 PreparedStatement stmt = null; 37 ResultSet rset = null; 38 39 try { 40 stmt = c.prepareStatement(_stepSequenceIncrement); 41 stmt.executeUpdate(); 42 rset = stmt.executeQuery(_stepSequenceRetrieve); 43 44 rset.next(); 45 46 long id = rset.getLong(1); 47 48 return id; 49 } finally { 50 cleanup(null, stmt, rset); 51 } 52 } 53 } 54 | Popular Tags |