Is it ever possible to use both unicode and non-unicode strings in Hibernate (version 4) and Microsoft SQL server (2008/2012)?
What we have now - customised SQL Server dialect that generate nvarchar
for strings:
public class SQLServerUnicodeDialect extends SQLServerDialect {
public SQLServerUnicodeDialect(){
super();
// Use Unicode Characters
registerColumnType( Types.VARCHAR, "nvarchar($l)" );
...
}
At jdbc level we're using JTDS driver that convert all strings as unicode by default (see parameter sendStringParametersAsUnicode).
So I see 2 problems in the task:
- How to say hibernate separate unicode and non-unicode strings?
- Which jdbc driver support both string types (looks like JTDS has 1 option - all strings as unicode or no)?
Any thoughts are welcome.