//Note: Remember that spring doesn't generate ID. The database generates the next id. Make sure the database
// has a trigger or autoincrement facility on the ID column.
SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_NAME)
.usingGeneratedKeyColumns("ID");
SqlParameterSource parameters = new BeanPropertySqlParameterSource(resource);
Number id = simpleJdbcInsert.executeAndReturnKey(parameters);
resource.setId(id.intValue());
return resource;
}