[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: hibernate: MS-SQL Server and UTF-8

mars1412 do-not-reply at jboss.com
Wed Feb 27 06:36:20 EST 2008


found the answer:

you have to create your own hibernate dialect and then set the correct column types:package mypackage;
  | 
  | import java.sql.Types;
  | 
  | public class SQLServerDialect extends 
  | org.hibernate.dialect.SQLServerDialect {
  | 
  | 	public SQLServerDialect() {
  | 		super();
  | 		registerColumnType(Types.CHAR, "nchar(1)" );
  | 		registerColumnType(Types.VARCHAR, "nvarchar($l)" );		
  | 	}
  | 
  | }
  | 

then use this dialect in your persistence.xml file:


see also http://forum.hibernate.org/viewtopic.php?t=972518&highlight=sql+server+nvarchar


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132458#4132458

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132458



More information about the jboss-user mailing list