-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm2ddl and nvarchar
PostPosted: Tue Jul 07, 2009 7:23 pm 
Newbie

Joined: Mon Mar 16, 2009 5:04 pm
Posts: 2
I have been scouring the internet but I can't seem to find the answer that I require about hibernate and its support for unicode.

I currently have a hibernate mapping file and I use hbm2ddl to generate the DDL for the mapping file.

What settings do I need to force hbm2dll to generate my "string" columns as "nvarchar" instead of varchar?

Thanks for any help!


Top
 Profile  
 
 Post subject: Re: hbm2ddl and nvarchar
PostPosted: Tue Jul 07, 2009 8:19 pm 
Regular
Regular

Joined: Fri Jan 30, 2009 10:10 am
Posts: 74
Location: London
Hi,

The key thing you need to know about here is that Hibernate will be generating the DDL statements based on what it knows about the particular RDBMS that you are using. That is configured through a Dialect.

A Google search showed up the following blog post:

http://blog.cherouvim.com/sql-server-hbm2ddl-unicode-columns/

which describes exactly what you have asked about.

Basically you:
- create a subclass of the Dialect for the RDBMS that you are using and make it override the existing default data type mappings
- specify your new class as hibernate.dialect in your Hibernate configuration


--
Stephen Souness




blog: http://elegant-solutions.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.