Spring JPA :: No converter found capable of converting from type

后端 未结 6 1748
有刺的猬
有刺的猬 2021-02-03 23:59

I am using spring with JPA and trying to execute query using @query with SQL query.and trying to map the result to an object. I have different entity class and mapping to other

6条回答
  •  伪装坚强ぢ
    2021-02-04 00:27

    Also you could try changing the UserRepository Interface declaration to below,

    public interface UserRepository extends CrudRepository {
        @Query(value = "select count(type_id) userCount, type_id, modified_at from "
                    + "user_campaign_objective where camp_id = ?1 group by objective_type_id,modified_at", nativeQuery = true)
    
            List getStatsDTO(Long camp_id);
    }
    

    The change is : CrudRepository from CrudRepository < UserEntity, Long>.

    I faced the same issue while using a different data object inside a repository declared with another data object.

提交回复
热议问题