0

I'm using spring boot with JpaRepository to query some specific attributes into a DTO object and pass it to some REST API:

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface BloqueioSaldoRepository extends JpaRepository<entity1, Long> {

  @Query("select b.idBloqueioSaldo, mb.descricao, b.dataBloqueio, b.valor "
      + "from entity1 b, entity2 mb, entity3 co "
      + "where b.motBloqueioSaldo = mb.id "
      + "and co.idCc = b.cc "
      + "and co.agencia = :agencia "
      + "and co.numConta = :conta")
  public List<myDTO> findByAgenciaAndConta(@Param("agencia") Long agencia, @Param("conta") Long conta);

}

But when I'm debugging I saw this: enter image description here

And Postman shows me this:

enter image description here

How can I make spring turn this list of lists into a list of myDTO objects? What I'm missing?

rado
  • 5,720
  • 5
  • 29
  • 51
  • i guess the list in your debugger is alreay the myDTO list you expected. the postman view is from your rest controller right? then it's already convertrd from your myDto list to json... – snap Jul 24 '18 at 16:38
  • If it were a object, it would be [{object1},{object2},{object3}] and not with [[object1],[object2],[object3]]. Do you get my point? My debugger shows a list of list of objects, and not a single list of myDTO's – rado Jul 24 '18 at 16:49
  • try .class call inside the debugger. maybe the object are of the expected type and the debugger just show the supertype Object for whatever reason. – snap Jul 24 '18 at 17:58

0 Answers0