* Insert a new process info into the database.
*/
private void insertProcess()
throws SQLException, IOException {
Connection con = null;
UniversalPrepStmt prepStmt = null;
try {
con = ds.getConnection();
prepStmt = new UniversalPrepStmt
(ds, con, "INSERT INTO process ("
+ "DBId, PackageId, ProcessId, XPDLREF, Name, State, "
+ "StateTime, Priority"
+ (paRequester != null
? ", Requester, ReqHash" : "")
+ ", Creator, ProcessMgr, "
+ "MgrVersion, CreateTime, Description, Flags) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?"
+ (paRequester != null ? ", ?, ?" : "")
+ ", ?, ?, ?, ?, ?, ?)");
int offset = 1;
Long procKey = (Long)ctx.getPrimaryKey();
prepStmt.setLong(offset++, procKey.longValue());
prepStmt.setString(offset++, packageId);
prepStmt.setString(offset++, processId);
prepStmt.setLong(offset++, xpdlRef);
prepStmt.setString(offset++, paName);
prepStmt.setString(offset++, paTypedState.toString());
prepStmt.setTimestamp
(offset++, new Timestamp (paLastStateTime.getTime()));
prepStmt.setInt(offset++, paPriority.toInt());
if (paRequester != null) {
prepStmt.setBinary(offset++, paRequester);
prepStmt.setInt (offset++, paRequester.hashCode ());
}
prepStmt.setString(offset++, processCreator);
prepStmt.setString(offset++, paProcessMgrName);
prepStmt.setString(offset++, paProcessMgrVersion);
prepStmt.setTimestamp
(offset++, new Timestamp (paCreateTime.getTime()));
prepStmt.setString(offset++, paDescription);
prepStmt.setInt(offset++, paFlags);
prepStmt.executeUpdate();
((ProcessDataStore)paProcessData).setConnection (con);
try {
((PersistentMap)paProcessData).store();
} catch (PersistentMapSQLException e) {
throw (SQLException)e.getCause();