In my project I want to store the Tamil characters in database. So I created the column for that with the datatype nvarchar(50).
Hibernate converts nvarchar to serializable. How to I set the value for this column?
Can anybody help to fix this issue?
In my project I want to store the Tamil characters in database. So I created the column for that with the datatype nvarchar(50).
Hibernate converts nvarchar to serializable. How to I set the value for this column?
Can anybody help to fix this issue?
I guess you have to write a custom dialect by extending SQLServerDialect that maps to the data type.
public class CustomSQLServerDialect extends SQLServerDialect {
public CustomSQLServerDialect() {
super();
// Use Unicode Characters
registerColumnType(Types.VARCHAR, "nvarchar($l)");
}
}
Madhesh, for having other languages characters in any of your fields in the Database, you don't need to worry about the types themselves, but you need to check the encoding that your field or table or even the Database itself is using (collation).
The most common one is utf8_general_ci:
Which is the best character encoding for Japanese language for DB, php, and html display?
I believe you can change these collations through the tool you use to access and modify your DB. Here are more detailed answers about character encoding and collations:
What does character set and collation mean exactly?
However, Tamil seems a special case, there is an open-tamil project for Tamil text processing in Github that may help you further, if UTF-8 encoding is not enough.