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

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

    You have a mismatch between the column names:

    • userCount
    • type_id
    • modified_at

    And your property names:

    • userCount
    • typeId
    • modifiedAt

    Since this is a native query the JPA naming strategy doesn't apply and the column names should match the property names. So if you change the query to the following, it should work:

    select count(type_id) userCount, type_id as typeId, modified_at as modifiedAt from ...
    

提交回复
热议问题