Xlsファイルのアップロード中に以下のコードがあり、Xlsシートの最後の行まで以下のメソッド呼び出しを行い、StringBuilderに値を追加しています。
public boolean insertBatch(Connection con, int projectId, int venueId, String batchName, String examStartDate, String examStartTime, String examEndTime, String reportingStartTime, String reportingEndTime, int totalSeats) {
String this.query = new StringBuilder().append("insert into venue_batch ( batch_code ,exam_venue_id ,exam_date ,exam_start_time ,exam_end_time ,reporting_start_time ,reporting_end_time ,total_seats,tranID) VALUES ('").append(batchName).append("' ,").append(venueId).append(" ,'").append(stDate).append("' ,'").append(examStartTime).append("' ,'").append(examEndTime).append("' ,'").append(reportingStartTime).append("' ,'").append(reportingEndTime).append("' ,").append(totalSeats).append(" )").toString();
try {
this.stmt = con.createStatement();
count = this.stmt.executeUpdate(this.query);
this.stmt.close();
} catch (SQLException ex) {
System.out.println(new StringBuilder().append("Venue # insertBatch # SQLException").append(ex.toString()).toString());
onUploadFail(con, "Please try again!");
}
}
*I need to add Unique Transaction id(VenueTranId) to DB at the last during executeUpdate(this.query), in the above Query how to Proceed below is Transaction id code.Thanks All..
Calendar calendar = Calendar.getInstance();
Long lngTime = Long.valueOf(calendar.getTimeInMillis());
String VenueTranId=lngTime.toString();