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

后端 未结 6 1760
有刺的猬
有刺的猬 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:28

    You can use the constructor expression JPQL query, your query looks like this:

    select new StatsDTO(count(u),u.typeId,u.modifiedAt) from UserCampaignObjective u where campId = ? group by objectiveTypeId,modifiedAt
    

    But you make sure the constructor StatsDTO existed already.

提交回复
热议问题