Hi all.
Let speak about Query and methods setString vs setParameter.
So.
1. setString
Code:
public Query setString(int position, String val) {
setParameter(position, val, StandardBasicTypes.STRING);
return this;
}
2. setParameter
Code:
public Query setParameter(String name, Object val) throws HibernateException {
if (val == null) {
Type type = parameterMetadata.getNamedParameterExpectedType( name );
if ( type == null ) {
type = StandardBasicTypes.SERIALIZABLE;
}
setParameter( name, val, type );
}
else {
setParameter( name, val, determineType( name, val ) );
}
return this;
}
Let speak if val !=null in this case different only on this :
Code:
[b]determineType( name, val )[/b]
SO. Question is: "What you prefer setString or setParameter for string value?"
In implementation we have difference. Do we have big difference on speed when we choosed one of them?
Cause setString() it is like what we have on JDBC. So what you think about this and if you prefer on of them let give answer for question "Why?"