stmt = prepareStatementWithKeys(conn, sql, entryId);
if (generatedKeys) { stmt = conn.prepareStatement(sql, new String[] {entryId}); } else { stmt = conn.prepareStatement(sql); }
    public WorkflowEntry createEntry(String workflowName) throws StoreException {        boolean generatedKeys = GENERATED.equals(entrySequence);        Connection conn = null;        PreparedStatement stmt = null;        try {            conn = getConnection();            String sql = "INSERT INTO " + entryTable + " (" + (generatedKeys ? "" : (entryId + ", ")) + entryName + ", " + entryState + ") VALUES (" + (generatedKeys ? "" : "?,") + "?,?)";            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql);            }            stmt = prepareStatementWithKeys(conn, sql, entryId);            long id = 0;            if (!generatedKeys) {                id = getNextEntrySequence(conn);                stmt.setLong(1, id);                stmt.setString(2, workflowName);                stmt.setInt(3, WorkflowEntry.CREATED);            } else {                stmt.setString(1, workflowName);                stmt.setInt(2, WorkflowEntry.CREATED);            }            stmt.executeUpdate();            if (generatedKeys) {                id = getGeneratedKey(stmt, entryId);            }            return new SimpleWorkflowEntry(id, workflowName, WorkflowEntry.CREATED);        } catch (SQLException e) {            throw new StoreException("Error creating new workflow instance", e);        } finally {            cleanup(conn, stmt, null);        }    }