你的陈述
@Query("select A.id, A.position ,A.title,A.shortdescription,A.thumbnailimage, A.linkactions, A.last_updated_date, A.last_updated_by, B.countryName " +
"from ContentManage as A inner join Country as B on A.countryid=B.countryId")
包含来自ContentManage
and Country
在选择.
但你的结果只是一个List<ContentManage>
为了解决这个问题,您可以创建一个新的 Dto 类,其中包含您需要的来自 A 和 B 的所有字段。此 Dto 类必须有一个全参数构造函数。然后代替
"select A.id, A.position ,A.title,A.shortdescription,A.thumbnailimage, A.linkactions, A.last_updated_date, A.last_updated_by, B.countryName " +
"from ContentManage as A inner join Country as B on A.countryid=B.countryId"
你可以写:
"select new com.you.package.YourDtoClass (A.id, A.position ,A.title,A.shortdescription,A.thumbnailimage, A.linkactions, A.last_updated_date, A.last_updated_by, B.countryName) " +
"from ContentManage as A inner join Country as B on A.countryid=B.countryId"