ResultSetMapper for List<Map<String, Object>> for SqlQuery
See original GitHub issueHi, I’m trying to create mapper for regular SqlQuery in the same manner like handle.select that is returning List of Map String, Object
Code example:
public interface SomeQueries
{
@SqlQuery("select * from SOMETABLE")
@Mapper(MapMappper.class)
public List<Map<String, Object>> sqlQuery();
}
public class MapMappper implements ResultSetMapper<List<Map<String, Object>>> {
@Override
public List<Map<String, Object>> map(int index, ResultSet r, StatementContext ctx) throws SQLException {
System.out.println(r);
Map<String, Object> obj = new HashMap<String, Object>();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
list.add(obj);
return list;
}
}
But I’m getting exception: unable to access mapper
Issue Analytics
- State:
- Created 10 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to make Mapper to sql query - Google Groups
public class MapMappper implements ResultSetMapper<List<Map<String, Object>>> { > > @Override > public List<Map<String, Object>> map(int ...
Read more >Cannot get all rows when using ResultSetMapper to parse ...
Im using Java 8 and Jdbi version 2.78 to query a database. I have a table of key-value configurations for merchants. enter image...
Read more >Jdbi 3 Developer Guide
A Query is a result-bearing SQL statement that returns a result set from the database. List<Map<String, Object>> users = handle.createQuery( ...
Read more >Spring JdbcTemplate Querying Examples - Mkyong.com
In Spring, we can use jdbcTemplate.queryForObject() to query a single row record from database, and convert the row into an object via row ......
Read more >Java JDBC How to - Create Utility for Working with ResultSets
//from w w w. jav a2 s .co m import java.sql. ... static List<Map<String, Object>> map(ResultSet rs) throws SQLException { List<Map<String, Object>> results ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this:
I should point out that the default mapper used by Query is already available as public API: org.skife.jdbi.v2.DefaultMapper. You can just use it directly if you want.
How to do this in JDBI3?