To initiate a batch update, your application calls this version of the updateMany() method:
int[] updateMany(String... heterogeneousBatchSQL)
The parameter heterogeneousBatchSQL can be a list of individual SQL statements or an array of String objects that contain SQL statements. The following two examples show the different methods of passing the SQL statements:
String insertDept = "insert into dept values("+dept.no+",'"+dept.name+"')";
String insertEmp = "insert into emp values("+emp.id+",'"+emp.name+"','"+emp.ssn+"',"+emp.dept_no+")";
String insertEmpProj = "insert into emp_proj values("+emp.id+","+dept.no+")";
int[] updateCounts = myData.updateMany (insertDept, insertEmp, insertEmpProj);
String[] sqlArray = new String[3];
sqlArray[0] = insertDept;
sqlArray[1] = insertEmp;
sqlArray[2] = insertEmpProj;
int[] updateCounts = myData.updateMany (sqlArray);
The method returns an integer array that has the same number of elements as SQL statements that you supplied. This array contains the same information that the Statement.executeBatch() method in JDBC returns.
If you are using annotated methods and want to call the updateMany() method, see Extending user-defined classes from generated implementation classes. You can call the updateMany() method like this:
int[] updateCounts = updateInf.updateMany (hetrogeneousBatchSQL);
updateInf.commit ();