public boolean save(List<SystemPoolForAS400> systemPoolForAS400List) { boolean result = false; try { if (systemPoolForAS400List != null) { for (int i = 0; i < systemPoolForAS400List.size(); i++) { SystemPoolForAS400 systemPoolForAS400 = (SystemPoolForAS400) systemPoolForAS400List.get(i); StringBuffer sql = new StringBuffer(); sql.append( "insert into nms_as400_system_pool(nodeid,ipaddress,system_pool,name,sizes,reserved_size,maximum_active_threads,collect_time) values('"); sql.append(systemPoolForAS400.getNodeid()); sql.append("','"); sql.append(systemPoolForAS400.getIpaddress()); sql.append("','"); sql.append(systemPoolForAS400.getSystemPool()); sql.append("','"); sql.append(systemPoolForAS400.getName()); sql.append("','"); sql.append(systemPoolForAS400.getSize()); sql.append("','"); sql.append(systemPoolForAS400.getReservedSize()); sql.append("','"); sql.append(systemPoolForAS400.getMaximumActiveThreads()); sql.append("','"); sql.append(systemPoolForAS400.getCollectTime()); sql.append("')"); conn.addBatch(sql.toString()); } conn.executeBatch(); } result = true; } catch (Exception e) { e.printStackTrace(); result = false; } finally { if (conn != null) { conn.close(); } } return result; }
public boolean save(BaseVo vo) { SystemPoolForAS400 systemPoolForAS400 = (SystemPoolForAS400) vo; StringBuffer sql = new StringBuffer(); sql.append( "insert into nms_as400_system_pool(nodeid,ipaddress,system_pool,name,sizes,reserved_size,maximum_active_threads,collect_time) values('"); sql.append(systemPoolForAS400.getNodeid()); sql.append("','"); sql.append(systemPoolForAS400.getIpaddress()); sql.append("','"); sql.append(systemPoolForAS400.getSystemPool()); sql.append("','"); sql.append(systemPoolForAS400.getName()); sql.append("','"); sql.append(systemPoolForAS400.getSize()); sql.append("','"); sql.append(systemPoolForAS400.getReservedSize()); sql.append("','"); sql.append(systemPoolForAS400.getMaximumActiveThreads()); sql.append("','"); sql.append(systemPoolForAS400.getCollectTime()); sql.append("')"); return saveOrUpdate(sql.toString()); }