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
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 ...