private int nameToIndex ( String parameterName ) throws SQLException { parameterMetadata . readMetadataFromDbIfRequired ( ) ; for ( int i = 1 ; i <= parameterMetadata . getParameterCount ( ) ; i ++ ) { String name = parameterMetadata . getName ( i ) ; if ( name != null && name . equalsIgnoreCase ( parameterName ) ) { return i ; } } throw new SQLException ( "there is no parameter with the name " + parameterName ) ; }
Convert parameter name to parameter index in the query .