【发布时间】:2019-02-01 08:18:35
【问题描述】:
我有一个通用的 tokenRepository 接口:
public interface TokenRepository<T_Token extends Token, T_id> {
@Modifying
@Query("UPDATE T_token as a SET a.revocationReason = :reason WHERE a.id = :id")
void revokeByTokenId (@Param("id") T_id id, @Param("reason") RevocationReason revocationReason);
}
还有一个专门的存储库接口:
public interface CustomerTokenRepository extends Repository<CustomerToken, Long>, TokenRepository<CustomerToken, Long> {}
当我启动 Spring Boot 应用程序时,休眠返回以下错误:
org.hibernate.hql.internal.ast.QuerySyntaxException: T_token is not mapped [UPDATE T_token as a SET a.revocationReason = :reason WHERE a.id = :id]
所以我的问题是:是否有可能以及如何将 java 泛型类型与 HQL 一起使用?
谢谢!
【问题讨论】:
标签: java spring hibernate spring-boot hql