简体   繁体   English

JPQL中有CONCAT_WS方法吗?

[英]Is there a CONCAT_WS method in JPQL?

I am wondering if there is something like the CONCAT_WS method in JPQL as I found it in the MYSQL documentation here: 我想知道是否有像JPQLCONCAT_WS方法,我在MYSQL documentation找到它:

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws

Anyone ever stumbled over anything comparable? 有没有人偶然发现任何可比的东西?

No, there is not. 不,那里没有。 JPQL does have following String functions: CONCAT, LENGTH, LOWER, SUBSTRING, TRIM, and UPPER. JPQL具有以下字符串函数:CONCAT,LENGTH,LOWER,SUBSTRING,TRIM和UPPER。 Only way in with older JPQL versions is to simply repeat separator between each value in CONCAT: 使用较旧的JPQL版本的唯一方法是简单地在CONCAT中的每个值之间重复分隔符:

SELECT CONCAT(se.string1, ';', se.string2) 
FROM SomeEntity se

With JPQL in the JPA 2.1 specification implementations it is possible to call database functions as follows (first arguments is name of the function, others are arguments to function): 使用JPA 2.1规范实现中的JPQL,可以按如下方式调用数据库函数(第一个参数是函数的名称,其他参数是函数的参数):

SELECT FUNCTION('CONCAT_WS', ';', se.string1, se.string2) 
FROM SomeEntity se

Older EclipseLink versions have same functionality via FUNC keyword. 较旧的EclipseLink版本通过FUNC关键字具有相同的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM