How to map sql native query result into DTO in spring jpa repository?
问题 Hi what I am trying to achieve is to get SQL native query result map into my DTO in java spring jpa repository, how do I do this properly? I try several code, but it does not work, here is what I tried: First try : @Repository public interface StockRepository extends RevisionRepository<Stock, Long, Integer>, JpaRepository<Stock, Long> { @Query(value = "SELECT stock_akhir.product_id AS productId, stock_akhir.product_code AS productCode, SUM(stock_akhir.qty) as stockAkhir " + "FROM book_stock