There is a performance penalty with instantiating a new exception, when filling the stack trace. By running a benchmark we found that there a lot of java.lang.NumberFormatException being thrown and swallowed in hibernate. These were tracked down to org.hibernate.jpa.spi.BaseQueryImpl.toNumberOrNull(String parameterName)
In this particular case there are two things that can be done to reduce the number of exceptions: 1) Move the place where toNumberOrNull() is called in findParameterRegistration() so that it only gets called when needed. 2) Do a check if the chars are digits before attempting the conversion to int
|