【发布时间】:2020-10-29 02:18:56
【问题描述】:
我正在尝试将文本转换为 varchar,因为我之前遇到过关于此错误消息的问题:
The data types text and varchar are incompatible in the equal to operator RSS
通过快速搜索,我发现我需要将文本值转换为 varchar 值。我已经这样做了:
@Query("SELECT e FROM DeStudent e " +
"WHERE CAST(e.studentExpression as varchar) = :studentExpression" +
"AND e.deactivationTime = '9999-12-31 00:00:00.000' " +
"AND (:studentName is null OR e.name = :studentName)" +
"AND (:studentDescription is null OR e.description = :studentDescription)" +
"AND (:studentExpression is null OR e.studentExpression = :studentExpression)"
)
但是我似乎收到了这个错误:
2020-07-08 14:42:39.947 ERROR o.h.hql.internal.ast.ErrorCounter: line 1:142: unexpected token: e
由于此修改,它不允许我运行应用程序。我不确定我做了什么,有什么帮助吗?谢谢你。我也尝试了不同的变体,例如将演员表移动到选择部分,但仍然是同样的错误。
【问题讨论】: