Created
January 8, 2014 22:41
-
-
Save wspeirs/8325877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use a ResultSetHandler implementation, ArrayHandler, to convert the | |
// first row into an Object[]. | |
ResultSetHandler<Object[]> handler = new ArrayHandler(); | |
// Create a QueryRunner that will use connections from | |
// the given DataSource | |
QueryRunner runner = new QueryRunner(dataSource); | |
// Generate a QueryExecutor for the query | |
QueryExecutor executor = runner.query("SELECT * FROM Person WHERE first_name=:first_name and last_name = :last_name"); | |
// Bind our parameters and execute the query | |
Object[] result = executor.bind("first_name", "John") | |
.bind("last_name", "Doe") | |
.execute(handler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment