|
I experience the same problem using Hibernate 5.0.1.Final on Sql Server 2008 R2 and on Sql Server 2012.
The problem is that sqljdbc42.jar driver from Microsoft reports a column type -9 (that is NVARCHAR in java.sql.Types). I solved this adding to custom dialect:
registerHibernateType(Types.NVARCHAR, StringNVarcharType.INSTANCE.getName());
Note that using jTDS 1.3.1 driver instead of the one provided by Microsoft solves the problem, as the column type reported is 12 (VARCHAR) instead of -9 (NVARCHAR).
Looking in back in SQLServer2005Dialect (if I'm not wrong, nvarchar was supported at least in 2005..), is missing the registration of NVARCHAR types...
|