我有一个通用的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应用程序时,hibernate返回以下错误:
org.hibernate.hql.internal.ast.QuerySyntaxException: T_token is not mapped [UPDATE T_token as a SET a.revocationReason = :reason WHERE a.id = :id]
所以我的问题是:是否可以以及如何在HQL中使用java泛型类型?
谢谢!
答案 0 :(得分:3)
是可能的
pdfjsLib.getDocument({
url: DEFAULT_URL,
cMapUrl: CMAP_URL,
cMapPacked: CMAP_PACKED,
}).then(function(pdfDocument) {
var maxPages = pdfDocument.numPages
for (var j = 1; j <= maxPages; j++){
let div1 = document.createElement("div");
div1.id = "doc-page-" + j;
//document.getElementById("body").appendChild(div);
var b = document.getElementById("container");
b.appendChild(div1);
}
console.log("document has " + pdfDocument.numPages +" pages")
console.log("document has " + pdfDocument.fingerprint +" fingerprint")
// Document loaded, retrieving the page.
var countPromisesText = []; // collecting all page promises
var countPromisesRender = []; // collecting all page promises
for (var j = 1; j <= 2; j++) {
var page = pdfDocument.getPage(j);
var txt = "";
countPromisesRender.push(page.then(function(page) {
// Creating the page view with default parameters.
var c = document.getElementById("doc-page-"+page.pageNumber);
var pdfPageView = new pdfjsViewer.PDFPageView({
container: c,
id: PAGE_TO_VIEW,
scale: SCALE,
DefaultViewport: page.getViewport(SCALE),
// We can enable text/annotations layers, if needed
textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory(),
AannotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
});
// Associates the actual page with the view, and drawing it
pdfPageView.setPdfPage(page);
return pdfPageView.draw();
}));
}
});
实体名称为@Modifying
@Query("UPDATE #{#entityName} as a SET a.userRevocationReason = :reason WHERE a.refreshToken.id = :rid")
void revokeByRefreshToken (@Param("rid") T_id refreshTokenId, @Param("reason") UserRevocationReason userRevocationReason);