-->
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: Custom UserType
PostPosted: Fri Oct 09, 2009 9:47 am 
Newbie

Joined: Fri Oct 09, 2009 7:57 am
Posts: 1
I have the following problem which I can not yet understand how to solve:

I need to treat some String fields of some objects (but not all of them) in hibernate mapping as NVARCHAR for MS SQLServer,
hence they should be saved in SQL as N'<value>' plus hbm2ddl should generate them as NVARCHAR(<specified length>)

I understand that simply extending SQLServerDialect and saying
Code:
registerColumnType(Types.VARCHAR, 4000, "nvarchar($1)");

will not work, will it? As this will make all strings (actually all types that are mapped to generic sql VARCHAR type) to be treated as NVARCHAR.

I understand that to resolve my problem I probably need to implement UserType interface and use my own type on those fields that needs to be treated as NVARCHAR, however I don't see at the moment that implementing this interface will help.

Kindly point me to right direction on resolving this. With given API (Hibernate 3.3.1.GA) I start to doubt that it is possible at all.


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.