the function (line 40 of SQLFunctionRegistry.java)
public SQLFunction findSQLFunction(String functionName) {
// TODO: lower casing done here. Was done "at random" before; maybe not needed at all ?
String name = functionName.toLowerCase();
SQLFunction userFunction = userFunctions.get( name );
return userFunction != null
? userFunction
: (SQLFunction) dialect.getFunctions().get( name );
}
returns null if a dialect registers a function with capital letters.
Also to functionName is lowered twice ( mentioned in the TODO comment already )
see line 363 SessionFactoryHelper.java
public SQLFunction findSQLFunction(String functionName) {
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() );
}
Test:
To reproduce the error just extend a dialect and call registerFunction in constructor
Example
public class SybaseSqlAnywhereDialect extends SybaseAnywhereDialect {
public SybaseSqlAnywhereDialect() {
super();
registerFunction("dayofweek", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(weekday, ?1)")); //Will work
registerFunction("dayOfWeek", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(weekday, ?1)")); // NPE Exception
}
}
Solution
A solution would be lowercase both sides or make the whole thing case sensitive
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira