title: The result of a jdbc query is not readable for my jasper (report dependency), but with JPA is okay
body: <p>SO: Debian 11 <br/>
  SDK: open-17 64 bit <br/>
  Spring-boot-starter-data-jdbc:2.6.4 <br/>
  Spring-jdbc:5.3.16 <br/>
  HikariCP:4.0.3 <br/>
  Postgres 14 <br/></p>
  <p>Hi. I try to make some pdf reports with Jasper Dependency inside of my Spring Boot project. Recently I was working with JPA, but I need to move to JDBC. I made a small report with JPA-Jasper, but try to do the same thing with JDBC-Jasper, and I have a problem with that, the type of data structure that jdbc.query is returning.</p>
  <p>When I sout the result of the query db with JPA and JDBC respectively, I see a result like this structure:
  JPA  ---&gt;  [{}, {}, ... {}]
  JDBC ---&gt;  [[], [], ... []]</p>
  <p>Log example
  JPA</p>
  <pre><code>[Transaccion{id=1, transaccion_tipo_id=2, transaccion_estado_id=1, usuario_id=18, monto=0.0, referencia=19-0100-9, codigo_verificacion=0}, ...]
  </code></pre>
  <p>JDBC</p>
  <pre><code>[Transaccion[id=1, transaccion_tipo_id=2, transaccion_estado_id=1, usuario_id=18, monto=0.0, referencia=19-0100-9, codigo_verificacion=0], ...]
  </code></pre>
  <p>Here I have my data access service, using jdbc.query</p>
  <pre><code>@Override
      public List&lt;Transaccion&gt; selectTransacciones() {
          var sql = &quot;&quot;&quot;
                  SELECT id, 
                         transaccion_tipo_id,
                         transaccion_estado_id,
                         usuario_id,
                         monto,
                         referencia,
                         codigo_verificacion
                  FROM procesadora.transaccion
                  LIMIT 200
                  &quot;&quot;&quot;;
  
          return jdbcTemplate.query(sql, new TransaccionRowMapper());
      };
  </code></pre>
  <p>This is what my rawMapper is returning</p>
  <pre><code>import org.springframework.jdbc.core.RowMapper;
  
  import java.sql.ResultSet;
  import java.sql.SQLException;
  
  public class TransaccionRowMapper implements RowMapper&lt;Transaccion&gt; {
      @Override
      public Transaccion mapRow(ResultSet resultSet, int rowNum) throws SQLException {
          return new Transaccion(
                  resultSet.getLong(&quot;id&quot;),
                  resultSet.getInt(&quot;transaccion_tipo_id&quot;),
                  resultSet.getInt(&quot;transaccion_estado_id&quot;),
                  resultSet.getInt(&quot;usuario_id&quot;),
                  resultSet.getDouble(&quot;monto&quot;),
                  resultSet.getString(&quot;referencia&quot;),
                  resultSet.getString(&quot;codigo_verificacion&quot;)
          );
      }
  }
  </code></pre>
  <p>Here is the transaccion Object, I use record to be make more cleaner.</p>
  <pre><code>public record Transaccion (Long id,
                             Integer transaccion_tipo_id,
                             Integer transaccion_estado_id,
                             Integer usuario_id,
                             Double  monto,
                             String  referencia,
                             String  codigo_verificacion) {
  }
  </code></pre>
  <p>Here I create the pdf Report</p>
  <pre><code>@Service
  public class TransaccionReporte {
      private final TransaccionService transaccionService;
  
      public TransaccionReporte(TransaccionService transaccionService) {
  
          this.transaccionService = transaccionService;
      }
  
      public String exportReport() throws FileNotFoundException, JRException {
          System.out.println(&quot;*** reporte begins ***&quot;);
          // bring data from db
          List&lt;Transaccion&gt; transaccions = transaccionService.getTransacciones();
  
          System.out.println(transaccions);  // &lt;--- here I expect [{}, {}] not [[], []]
          System.out.println(transaccions.getClass());
  
          System.out.println(&quot;*** List transacciones done ***&quot;);
          // load file - blueprint for the pdf
          File file = ResourceUtils.getFile(&quot;classpath:transaccion.jrxml&quot;);
  
          System.out.println(&quot;*** Load file done ***&quot;);
          // compile it
          JasperReport jasperReport = JasperCompileManager.compileReport(file.getAbsolutePath());
          JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(transaccionService.getTransacciones());
      ...
  
  </code></pre>
  <p>I think that is not a difficult problem, but a need more information about rowMapper, jdbc and all stuff releted to that, I anybody can give me a clue I'll very appreciated.</p>
  <p>This is the repo I working on: <a href="https://github.com/biagiola/spring-jdbc-jasper-report" rel="nofollow noreferrer">https://github.com/biagiola/spring-jdbc-jasper-report</a></p>