gpt4 book ai didi

java - Hibernate HQL 带有 Likes 的意外标记

转载 作者:行者123 更新时间:2023-12-01 16:50:26 24 4
gpt4 key购买 nike

我的 Spring Web 模型- View - Controller (MVC) 框架中有这个类。 Spring Web 模型- View - Controller (MVC) 框架的版本是 3.2.8。

我在 1 个 DAO 中有这个方法

final StringBuilder queryString = new StringBuilder("  select app from Application app where upper (ticket_id) like :searchString and upper (id) like :searchString " );

queryString.append("where app.status != " + Status.READY.ordinal());

queryString.append(" order by app.submissionTime desc ");

try {

final Query query = getEntityManager().createQuery(queryString.toString());

searchString = searchString.replace("!", "!!")
.replace("%", "!%")
.replace("_", "!_")
.replace("[", "![")
.trim()
.toUpperCase();


query.setParameter ("searchString", searchString);

return query.getResultList();

但是我在运行时遇到此错误:

 org.   where near line 1, column 144 [  select app from com.tdk.devices.domain.Application app where upper (ticket_id) like :searchString and upper (id) like :searchString where  app.status != 0 order by app.submissionTime desc ]

最佳答案

您使用了“where”子句 2 次。首先在StringBuilder的构造函数中,然后:

queryString.append("where  app.status != " + Status.READY.ordinal());

关于java - Hibernate HQL 带有 Likes 的意外标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41183289/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com