Help with executeAndFetchTable().asList() + JRMapCollectionDataSource

185 views
Skip to first unread message

FkJ

unread,
Nov 26, 2015, 11:44:35 AM11/26/15
to sql2o
Hi,

Probably I'm missing something basic, but the following code doesn't compile:

try (Connection con = sql2o.open())
{
Collection<Map<String, Object>> result = con.createQuery(sql.toString()).executeAndFetchTable().asList();
JRMapCollectionDataSource dataSource = new JRMapCollectionDataSource(result);
        ...

I'm getting this error: The constructor JRMapCollectionDataSource(List<Map<String,Object>>) is undefined

Class constructor looks like this: public JRMapCollectionDataSource(Collection<Map<String,?>> col)

I tried to change result to Collection<Map<String, ?>>, but then I get this: Type mismatch: cannot convert from List<Map<String,Object>> to Collection<Map<String,?>> 

Is there any workaround better than iterate the map returned by Sql2o and create a new one that will be compatible with JasperReports?

Sql2o version is 1.5.4, JasperReports version is 5.5.0.

Thanks

FkJ

unread,
Jan 25, 2016, 10:59:21 AM1/25/16
to sql2o

dpon...@gmail.com

unread,
Apr 18, 2018, 1:25:26 PM4/18/18
to sql2o
Reply all
Reply to author
Forward
0 new messages