Incorrect SQL generated from Criteria API when concat() and function() methods are used together

Description

I have a test case here: https://github.com/archiecobbs/hibernate-test-case-templates/tree/time-concat-bug

A criteria API query containing this logic fails:

The code is saying "invoke the FORMATDATETIME() function with two arguments, then concatenate the result with an empty string".

But what the SQL query says is "invoke the FORMATDATETIME() function with the concatenation of two arguments, then concatenate the result with an empty string".

This is obviously wrong, and in this case it causes the SQL compilation to fail because FORMATDATETIME() requires at least two arguments:

Environment

None

Activity

Show:
Nathan Xu
August 20, 2020, 3:19 AM

Thanks for the complete bug reporting. The root cause turns out to be some code sloppiness. A PR has been created at

Archie Cobbs
August 20, 2020, 5:55 PM

Wow, thanks for the quick turnaround!!

Usually it seems my Hibernate bugs are completely ignored, e.g. , , .

Nathan Xu
August 20, 2020, 7:40 PM

I will tend to them next week.

Nathan Xu
September 7, 2020, 1:34 PM

Now all your above tickets have been fixed. Enjoy your high-quality bug reporting pretty much! They help to improve the Criteria feature dramatically.

Archie Cobbs
September 7, 2020, 6:51 PM

Thanks, glad to help.

Assignee

Nathan Xu

Reporter

Archie Cobbs

Fix versions

Labels

backPortable

Backport?

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure