Skip to content

Instantly share code, notes, and snippets.

@langmi
Created September 30, 2011 09:19
Show Gist options
  • Save langmi/1253206 to your computer and use it in GitHub Desktop.
Save langmi/1253206 to your computer and use it in GitHub Desktop.
Implementation for ItemSqlParameterSourceProvider which creates a MapSqlParameterSource directly from the FieldSet
/**
* Implementation for {@link ItemSqlParameterSourceProvider},
* creates {@link MapSqlParameterSource} from {@link FieldSet}.
*
* @author Michael R. Lange <[email protected]>
*/
public class FieldSetSqlParameterSourceProvider implements ItemSqlParameterSourceProvider<FieldSet> {
/** {@inheritDoc} */
@Override
public SqlParameterSource createSqlParameterSource(FieldSet item) {
MapSqlParameterSource sps = new MapSqlParameterSource();
for (Entry<Object, Object> entry : item.getProperties().entrySet()) {
sps.addValue(entry.getKey().toString(), entry.getValue());
}
return sps;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment