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
Post a Comment