I have a @Query Spring, which performs a query to the bank by an Entity, to create some DTO Objects. And the properties of this DTO object, I passed via Builder, but I needed to pass as a parameter on the List constructor it has in the Entity.
public OperacaoDTO(List<Staging> stagings, BigDecimal valor) {
this.stagings = stagings;
this.valor = valor;
}
My @Query
@Query("SELECT NEW br.com.teste.OperacaoDTO(operacao.stagings, operacao.valor) FROM Operacao operacao")
List<OperacaoDto> findAll();
The problem he complains about saying he does not have an appropriate constructor in OperationDTO. Is there any way for this List of the Entity to pass in the constructor? because I'm going to perform some treatment on this List