public int insertRight(ArrayList arr,Connection conn)throws SQLException,NamingException{
Statement stmt = conn.createStatement();
dbCleaner = DBCleaner.getInstance();
int[] i = null;
String sql = "";
try{
for(int ii=0;ii<arr.size();++ii){
  sql = (String)arr.get(ii);
System.out.print(sql);
  stmt.addBatch(sql);
}

i = stmt.executeBatch();
}catch(Exception e){
System.out.print("2--------"+e.getMessage());
}finally{
dbCleaner.cleanStatement(stmt);
return i.length;
}
}用的是批量插入数据.
其中会有父表和子表,用事务提交的时候报错"插入值或更新值不等于父表中的父键的任何值".
请问用什么方法可以解决.
必须要用事务提交