I have this query in my repository in java with spring framework:
@Query(value = "SELECT cr.reviewer_name, cr.message, cr.rating, cr.source, cr.show_status, cr.created_date, " +
"cr.group_index, string_agg(cr.type, ',') " +
"FROM customer_review cr " +
"WHERE cr.type LIKE 'NEWCAR%' AND cr.object_code = :objectCode AND cr.is_deleted NOT IN (true) " +
"GROUP BY cr.reviewer_name, cr.message, cr.rating, cr.source, cr.show_status, cr.created_date, cr.group_index " +
"LIMIT :limit OFFSET :offset", nativeQuery = true)
List<Object[]> findByObjectCode(@Param("objectCode") String objectCode, @Param("limit") Integer limit, @Param("offset") Integer offset);
I made sure the table name is exactly the same in the query. But it always returns the following error:
The column name group_index was not found in this ResultSet.
I tryed to rewrite the query, and run it manually on postgres and it works. But when I use it on my repository interface, it retuns the error.
Here is my table:

Sorry but why the return type is a List of Object array?
Why don't you use a model or a projection spring?