@Override public BaseVo loadFromRS(ResultSet rs) { SystemPoolForAS400 systemPoolForAS400 = new SystemPoolForAS400(); try { systemPoolForAS400.setNodeid(rs.getString("nodeid")); systemPoolForAS400.setIpaddress(rs.getString("ipaddress")); systemPoolForAS400.setSystemPool(rs.getString("system_pool")); systemPoolForAS400.setName(rs.getString("name")); systemPoolForAS400.setSize(rs.getString("sizes")); systemPoolForAS400.setReservedSize(rs.getString("reserved_size")); systemPoolForAS400.setMaximumActiveThreads(rs.getString("maximum_active_threads")); systemPoolForAS400.setCollectTime(rs.getString("collect_time")); } catch (SQLException e) { e.printStackTrace(); } return systemPoolForAS400; }
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()); }