JPQL我们不能使用CONCAT(String,Integer)EclipseLink吗? [英] JPQL we can't CONCAT(String, Integer) EclipseLink?

查看:111
本文介绍了JPQL我们不能使用CONCAT(String,Integer)EclipseLink吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JPQL查询中,我试图在选择子句中使用CONCAT JPQL函数将字符串与整数连接起来,例如:

In a JPQL query I tried to concatenate a string with a integer, using CONCAT JPQL function, in a select clause, for example:

SELECT CONCAT(c.idClient, ' ', c.name) FROM Clients c;

但是结果不是可读的字符串。

But the result is not a readable String.

我们只能在CONCAT函数中使用String吗?

Can we only use String in CONCAT function?

预先感谢。

推荐答案

CONCAT用于字符串,用数字调用它的结果很可能取决于您的数据库。

CONCAT is meant for Strings, the result of calling it with a number would most likely depend on your database.

您可以尝试将id转换为首先使用char,可以在EclipseLink中使用FUNC函数来调用数据库中的本机函数,该函数将从数字转换为char。

You could try converting the id to a char first, you could use the FUNC function in EclipseLink to call a native function in your database that converts from numeric to char.

这篇关于JPQL我们不能使用CONCAT(String,Integer)EclipseLink吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆