org.hibernate.query.Query typed parameter recommendations: setParameter(String, Object) vs. setParameter(String, Object, Type)

On the vast majority of cases, using the setParameter(String, Object) is the way to go.

The setParameter(String, Object, Type) is useful when you are binding a custom type that was not added to the Type registry.

Is there any performance implications of using the method where the type is not specified?

For JPQL queries, the parameter metadata is provided during query parser phase, so the type is already known prior to binding it.

For native SQL queries, when using setParameter(String, Object) the type must be resolved like this:

typeResolver.resolveParameterBindType( value );

which boils down to getting the Typevalue from a Map. Therefore, it’s not something you should worry about. Most often, data access performance is driven by the effectiveness of the underlying queries as well as the amount of data you are fetching.