Background
We have a list of tables in a database, we want to read them through select statements, then turn the result into csv files
Problem
I could use mybatis to load data from tableA then map it to a resultMap A, then using openCSV to save it as a csv file.
but I am seeking a generic way, which I only need to specify
<sql> select * from tableA </sql>
<csvFile> A.csv </csvFile>
<mapping> Table.1stName = CSV.firstName </Mapping>
<mapping> Table.2ndName = CSV.secondName </Mapping>
........
in my config.xml, and my program should be able to run the sql select then map the resultset to a generic resutMap in mybatis? or turn the results into xml or csv or any string format?
then I can composing the csv file using the mapping in my config
the key question is how to let the mybatis return a more generic format of the resultset, rather than map it to a specific object.