Skip to content

Commit 9351bcf

Browse files
committed
HHH-15266 Fix NPE during function logging due to wrong character_length alternative key registration
1 parent 967ede4 commit 9351bcf

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/function/CommonFunctionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ public void length_characterLength_pattern(String clobPattern) {
13611361
"character_length",
13621362
new LengthFunction( "character_length", "character_length(?1)", clobPattern, typeConfiguration )
13631363
);
1364-
functionRegistry.registerAlternateKey( "character_length", "length" );
1364+
functionRegistry.registerAlternateKey( "length", "character_length" );
13651365
}
13661366

13671367
/**

hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmFunctionRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ public SqmFunctionDescriptor wrapInJdbcEscape(String name, SqmFunctionDescriptor
292292
}
293293

294294
public void registerAlternateKey(String alternateKey, String mappedKey) {
295+
assert functionMap.containsKey( mappedKey );
295296
log.debugf( "Registering alternate key : %s -> %s", alternateKey, mappedKey );
296297
alternateKeyMap.put( alternateKey, mappedKey );
297298
}

0 commit comments

Comments
 (0)