Most databases (at least PostgreSQL & H2) do have 'concat' function built-in but the hibernate dialects register it as regular string concatenation using || operator.
*registerFunction _registerFunction ( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","||",")" ) ); * _
The problem is the two behaves differently when passing NULL values. Built-in function skip NULLs when concatenating and returns NULL only if *ALL* parameters are NULLs, while the way hibernate translates it returns NULL if *ANY* of the parameters is NULL. |
|