Performance difference in various Hibernate Queries on VarChar MsSql columns -


i have query in hibernate believe because of varchar , nvarchar discrepancies in driver , mssql discussed here getting hibernate , sql server play nice varchar , nvarchar. understand issue not hibernate confused way hibernate deals code below .

when ran queries below (using set parameter , without it), on db varchar column type column 'code' , found appending string in hql works lot faster setparameter(or criteria query should have been faster hql) .

query createquery = session.createquery("from abc code='"+substring+"'"); /*query createquery = session.createquery("from abc   code=:substring");                 createquery.setparameter("substring","test");*/                 return createquery.list(); 

please let me know how make difference.

the execution plan computed database different between 2 queries. similar problem described in this question, , dba told me same problem can appear oracle well.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -