I have a mysql
stored procedure
which joins multiple tables and returns a table. I am invoking the stored procedure
from my Spring data
repository
-
@Query(value = "CALL get_emp_details(:id);", nativeQuery = true)
public List<Object[]> getEmpDetails(@Param("id") long id);
The above method return List<Object[]>
.
[[1890372504,0,"emp.new4444@gmail.com","GB","FUND","GRP280150","GBP","090950a4-ea97-4dc0-b109-702000c47c16","Org-258","GRP280150",1],[1890372504,0,"emp.new4444@gmail.com","GB","FUND","GRP280150","GBP","89d7a44f-b9b7-4d06-b8c2-137d4e7b8e8a","Org-258",null,1]
I want to convert this list of object array for Employee
1890372504
to a json. Any idea on how to achieve that? Appreciate the help.
Please note procedure
get_emp_details(:id)
select query should have "as" clause same as entity class(POJO) attributes ie employee and replace
List<Object[]> to List< Employee>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.