如何在JPQL查询中使用CAST函数

时间:2019-05-02 08:35:31

标签: postgresql casting jpql

我试图在CAST查询中使用JPQL函数将数据类型从Integer转换为String。但是我得到QuerySyntaxException

JPQL查询

@Query("select a from Alerts as a "
        + "Inner Join RoomTransfer as rt ON  a.salertActionData= cast (rt.nTransId character varying)" 
        + " where a.nalertId=?1")
public List<Alerts> transferedDetailsByAlertId(Integer nalert_id );

错误

java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting CLOSE, found 'varying' near line 1

有人可以告诉我我在做什么错吗?