Spring boot 如何在@query注释中编写包含DTO类构造函数的查询?

Spring boot 如何在@query注释中编写包含DTO类构造函数的查询?,spring-boot,Spring Boot,这是我的存储库,ChecklistCitem是我的DTO类: @Query(value="SELECT new com.inspectionApp.CheckList.DTO.ChecklistCitem(p.identifier,p.title,p.descrp,p.checklistIdentifier,p.checklistItemType,c.identifier,c.title,c.descrp,c.checklistType,c.isActive)" + "FROM

这是我的存储库,ChecklistCitem是我的DTO类:

@Query(value="SELECT new com.inspectionApp.CheckList.DTO.ChecklistCitem(p.identifier,p.title,p.descrp,p.checklistIdentifier,p.checklistItemType,c.identifier,c.title,c.descrp,c.checklistType,c.isActive)"
        + "FROM ChecklistItemPool p INNER JOIN Checklist c ON p.checklistIdentifier=c.identifier",nativeQuery=true)
List<ChecklistCitem> fetchAll();

}

为什么要在本机查询中使用构造函数?如果是用于返回对象内部的查询结果,那么有一些更好的选项可用。您只能在JPQL中使用,而不能在普通SQL查询中使用。为什么要在本机查询中使用构造函数?如果是用于返回对象内部的查询结果,那么有一些更好的选项可用。您只能在JPQL中使用,而不能在普通SQL查询中使用。
 """com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '.'."""