REST API执行JPQL查询时出现“Cannot convert orderAccount into valid entity ID”

image
image
image

你的查询方法不对,CUBA 平台对实体的查询分两种,一种是“实体查询”,一种是“JPQL查询”.
实体查询:https://doc.cuba-platform.cn/manual-7.0-chs/rest_api_v2_ex_get_entities_list.html
JPQL查询:https://doc.cuba-platform.cn/manual-7.0-chs/rest_api_v2_ex_query_get.html

你用的是实体查询的调用方式。

还是不行啊
image
这行是灰色的,声明好像没有生效
image

你用的是实体查询的URL

image

这里已经改正过了

最后不是说 server error 了么?看看 server 的 log 报什么错了?

server-log这个是哪个文件

就是 app.log 这个是应用程序日志

app.log (38.5 KB)

com.haulmont.cuba.core.global.RemoteException: You have attempted to set a value of type class java.lang.Integer for parameter price with expected type of class java.lang.String from query string select e from firstrestapi_Order e where e.amount = :amount and e.price = :price.

您在尝试将参数 price 的值设置为 Integer,但是期望的类型是 String

image
把参数类型设置为String之后还是报错。
image

这个新的错是关于 amount 了。amount 应该是 integer, 参数类型要跟你在实体中定义的类型一致,你试试下面这个定义

        <params>
            <param name="amount" type="java.lang.Integer"/>
            <param name="price" type="java.lang.String"/>
        </params>