Code example for PreparedStatement

Methods: setFloat, setLong, setString

0
	public void save(final String triggerName, final DiskPartition[] partition) {
		jdbcTemplate.update("DELETE FROM RPS_PERF_DISK WHERE TRIGGERID = ?", new Object[]{triggerName});
		int[] result = jdbcTemplate.batchUpdate("INSERT INTO RPS_PERF_DISK(triggerId, fileSystem, type, size, used, " +
				"available, usedRate, mountedOn) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { 
			public void setValues(PreparedStatement ps, int i) throws SQLException {
				ps.setString(1, triggerName);
				ps.setString(2, partition[i].getFileSystem());
				ps.setString(3, partition[i].getType());
				ps.setLong(4, partition[i].getSize());
				ps.setLong(5, partition[i].getUsed());
				ps.setLong(6, partition[i].getAvailable());
				ps.setFloat(7, partition[i].getUsedRate());
				ps.setString(8, partition[i].getMountedOn());
			} 
			public int getBatchSize() { 
				return partition.length;
			} 
		}); 
	} 
	 
	public int delete(long id) {