【发布时间】:2020-01-27 17:21:16
【问题描述】:
在 Spring Data JPA 中尝试使用接口投影技术:
interface DocInfoShort {
var docTypeId: Int
}
还有我的 DAO:
public interface DocRepository extends JpaRepository<Doc, Long> {
@Query("select sum(cast(doc.isSent AS int)) as docTypeId" +
" from Doc doc group by docTypeId", nativeQuery = true)
fun someQuery(): List<DocInfoShort>
}
但它不起作用:
could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet"
我该如何解决它。
【问题讨论】:
标签: spring hibernate kotlin spring-data-jpa hql