File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
hibernate-community-dialects/src/main/java/org/hibernate/community/dialect
hibernate-core/src/main/java/org/hibernate/dialect/function Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -336,12 +336,15 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
336336 functionFactory .stddev ();
337337 functionFactory .variance ();
338338 functionFactory .bitLength_pattern ( "length(?1)*8" );
339-
339+
340340 if ( getVersion ().isBefore ( 12 ) ) {
341- functionContributions .getFunctionRegistry ().register ( "coalesce" , new NvlCoalesceEmulation () );
341+ functionContributions .getFunctionRegistry ().register (
342+ "coalesce" ,
343+ new NvlCoalesceEmulation ( SqlAstNodeRenderingMode .INLINE_ALL_PARAMETERS )
344+ );
342345 }
343346 else {
344- functionFactory .coalesce (SqlAstNodeRenderingMode .INLINE_ALL_PARAMETERS );
347+ functionFactory .coalesce ( SqlAstNodeRenderingMode .INLINE_ALL_PARAMETERS );
345348 functionFactory .locate_charindex ();
346349 }
347350 functionContributions .getFunctionRegistry ().register ( "least" , new CaseLeastGreatestEmulation ( true ) );
Original file line number Diff line number Diff line change 1616import org .hibernate .query .sqm .produce .function .StandardFunctionReturnTypeResolvers ;
1717import org .hibernate .query .sqm .tree .SqmTypedNode ;
1818import org .hibernate .query .sqm .tree .expression .SqmExpression ;
19+ import org .hibernate .sql .ast .SqlAstNodeRenderingMode ;
1920
2021import java .util .List ;
2122
3132public class NvlCoalesceEmulation
3233 extends AbstractSqmFunctionDescriptor {
3334
35+ private final SqlAstNodeRenderingMode inferenceArgumentRenderingMode ;
36+
3437 public NvlCoalesceEmulation () {
38+ this ( SqlAstNodeRenderingMode .DEFAULT );
39+ }
40+
41+ public NvlCoalesceEmulation (SqlAstNodeRenderingMode inferenceArgumentRenderingMode ) {
3542 super (
3643 "coalesce" ,
3744 StandardArgumentsValidators .min ( 2 ),
3845 StandardFunctionReturnTypeResolvers .useFirstNonNull (),
3946 StandardFunctionArgumentTypeResolvers .IMPLIED_RESULT_TYPE
4047 );
48+ this .inferenceArgumentRenderingMode = inferenceArgumentRenderingMode ;
4149 }
4250
4351 @ Override
@@ -50,6 +58,7 @@ protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
5058 queryEngine .getSqmFunctionRegistry ()
5159 .namedDescriptorBuilder ("nvl" )
5260 .setExactArgumentCount (2 )
61+ .setArgumentRenderingMode ( inferenceArgumentRenderingMode )
5362 .descriptor ();
5463
5564 int pos = arguments .size ();
You can’t perform that action at this time.
0 commit comments