| If the native query returns tuple containing null values, then NativeQueryTupleTransformer throws IllegalArgumentException with the message "Unknown alias [aliasName]", where aliasName is the name of the column having null value. For instance, "aliasToValue" contains entries <id, 1> <value, null> For this case "Unknown alias [value]" will be shown. Bug is caused by:
Object tupleElement = aliasToValue.get( alias.toLowerCase() );
if ( tupleElement == null ) {
throw new IllegalArgumentException( "Unknown alias [" + alias + "]" );
}
which returns null for the key which is present in the map, but the value itself is null. Suggested fix: We have to check if the key is present in "aliasToValue" map via "containsKey" method. |