-->
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: Unicode strings and SQLServer
PostPosted: Tue Sep 12, 2006 6:24 pm 
Newbie

Joined: Tue Sep 12, 2006 5:51 pm
Posts: 1
Location: Seattle
We are getting DataTruncation errors writing a 51 character Java string to an nvarchar(100). A 50 character string works fine.

We used a custom dialect to ensure that the column is an nvarchar, and the XDoclet tag is as follows:

Code:
     * @hibernate.property
     *   column="Name"
     *   length="100"
     *   not-null="false"


Code:
public class UnicodeSQLServerDialect extends SQLServerDialect {

    public UnicodeSQLServerDialect() {
        registerColumnType( Types.CHAR, "nchar(1)" );
        registerColumnType( Types.VARCHAR, "nvarchar($l)" );
        registerColumnType( Types.CLOB, "ntext" );
    }
}


I have verified that the column is in fact nvarchar(100).

Any ideas for troubleshooting this? We are on Hibernate 3.1 and SQLServer.2005, the driver is jtds: 1.2.

Thanks,
Richard


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.