-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [SQLServer] varchar(255) columns=>nvarchar(4000) parameters
PostPosted: Tue Nov 20, 2012 8:26 am 
Newbie

Joined: Tue Nov 20, 2012 6:50 am
Posts: 1
Hibernate version : 3.3.1

We're encountering heavy performance problems that have been traced back to implicit conversion of query parameters, that cause SQL Server to ignore indexes and force it to recalculate query plans every single time.

All of the String fields in our application are mapped to varchar(255) through automatic schema generation.
Yet all string parameters in queries, when executed, are translated to nvarchar(4000), which causes implicit conversion in SQL Server.

This seems to be a common problem in NHibernate :
http://stackoverflow.com/questions/6626394/how-does-one-make-nhibernate-stop-using-nvarchar4000-for-insert-parameter-stri
http://zvolkov.com/clog/2009/10/28?s=NHibernate+parameter+sizes+controversy

But we're using Hibernate.
I've found this thread (http://stackoverflow.com/questions/5237280/getting-hibernate-and-sql-server-to-play-nice-with-varchar-and-nvarchar) that offers a solution to go from nvarchar(4000) to varchar(8000), but what we'd like is to match query parameter types and column types.

Is this possible ?

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.