MySQL's concat_ws function is not supported

Description

The MySQL string concatenation function "concat_ws" is not supported by Hibernate, although the MySQLDialect.java class lists its sister function "concat" :
registerFunction("concat", new StandardSQLFunction("concat", StandardBasicTypes.STRING));

While executing some request beginning with SELECT CONCAT_WS(...) FROM ...
the following exception is thrown:

Caused by: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode
-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'CONCAT_WS'
-[EXPR_LIST] SqlNode: 'exprList'
...

Note: this function was NOT introduced in MySQL 5.x - see MySQL doc: http://dev.mysql.com/doc/refman/4.1/en/string-functions.html#function_concat-ws

Environment

Hibernate 3.3.2 GA (hibernate-core-3.3.2.GA.jar)
MySQL 5.5.27 Community Server (GPL)

Activity

Show:
Brett Meyer
April 7, 2014, 5:45 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

maxxyme
April 8, 2014, 3:02 PM

There is no need for a test case to understand this issue.
But for completeness I downloaded the latest stable version: hibernate-core-4.3.5.Final

In package "org.hibernate.dialect" none of the following classes have the "concat_ws" MySQL function:
MySQL5Dialect
MySQL5InnoDBDialect
MySQLDialect
MySQLInnoDBDialect
MySQLMyISAMDialect

Only org.hibernate.dialect.MySQLDialect has its sister function:

registerFunction("concat", new StandardSQLFunction("concat", StandardBasicTypes.STRING));

Brett Meyer
April 8, 2014, 3:15 PM

Thanks for the response!

Steve Ebersole
October 27, 2015, 7:16 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Steve Ebersole
October 28, 2015, 3:24 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Assignee

Brett Meyer

Reporter

maxxyme

Fix versions

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure