-->
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.  [ 4 posts ] 
Author Message
 Post subject: Support for unicode columns in MS SQL Server database?
PostPosted: Fri Oct 20, 2006 7:34 pm 
Newbie

Joined: Fri Nov 04, 2005 11:42 am
Posts: 13
Hi

I want to create tables with column types "nvarchar, nchar, etc" (unicode aware columns) in the MS SQL server database. How do I that using Hibernate?

I saw a couple of articles about a different dialect to use "SQLServerIntlDialect", but it doesnt seem to be in Hibernate 3.2. If its not yet added, is there a way to do what I want to do? If yes, what is the best way to do it? Thanks.

Neha.


Last edited by Neha on Wed Oct 25, 2006 4:01 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 2:10 pm 
Newbie

Joined: Fri Nov 04, 2005 11:42 am
Posts: 13
??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 2:21 pm 
Newbie

Joined: Fri Nov 04, 2005 11:42 am
Posts: 13
Developers, your response to this will be very helpful. Thanks.

Neha.


Top
 Profile  
 
 Post subject: Re: Support for unicode columns in MS SQL Server database?
PostPosted: Tue Mar 12, 2013 9:52 am 
Newbie

Joined: Tue Mar 12, 2013 9:33 am
Posts: 2
Code:
public class SQLServerUnicodeDialect extends org.hibernate.dialect.SQLServerDialect {
    public SQLServerUnicodeDialect() {
        super();
        registerColumnType(Types.CHAR, "nchar(1)");
        registerColumnType(Types.LONGVARCHAR, "nvarchar(max)" );
        registerColumnType(Types.VARCHAR, 4000, "nvarchar($l)");
        registerColumnType(Types.VARCHAR, "nvarchar(max)");
        registerColumnType(Types.CLOB, "nvarchar(max)" );

        registerColumnType(Types.NCHAR, "nchar(1)");
        registerColumnType(Types.LONGNVARCHAR, "nvarchar(max)");
        registerColumnType(Types.NVARCHAR, 4000, "nvarchar($l)");
        registerColumnType(Types.NVARCHAR, "nvarchar(max)");
        registerColumnType(Types.NCLOB, "nvarchar(max)");

        registerHibernateType(Types.NCHAR, StandardBasicTypes.CHARACTER.getName());
        registerHibernateType(Types.LONGNVARCHAR, StandardBasicTypes.TEXT.getName());
        registerHibernateType(Types.NVARCHAR, StandardBasicTypes.STRING.getName());
        registerHibernateType(Types.NCLOB, StandardBasicTypes.CLOB.getName() );
    }
}


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

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.