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.