1

I need to insert Chinese characters inside Oracle Data base using Java (hibernate 3.0 /jpa), I tried many methods and failed.

When I persist the entity I see (??? ) in the filed and when I retrieve the value I see the same result.

My Oracle NLS_DATABASE_PARAMETERS:

NLS_CHARACTERSET   WE8MSWIN1252
NLS_NCHAR_CHARACTERSET  AL16UTF16 

The column type is Nvarchar. I set this properties in persistence.xml

<property name="hibernate.connection.useUnicode" value="true"  />
<property name="hibernate.connection.characterEncoding" value="UTF-8"/>
<property name="hibernate.connection.charSet" value="UTF-8"/>

2 Answers 2

2

If you have the chance, then convert your database from the character set WE8MSWIN1252 to AL32UTF8 (which is the default for new Oracle installations). Then all your problems will be gone and you don't need to use problematic data types like NCHAR or NVARCHAR or any special connnection settings.

Sign up to request clarification or add additional context in comments.

Comments

1

I had the same problem in SQL server and there we solved it by converting all the varchar fields to nvarchar. Also all the corresponding store procedures and return types need to be changed. Make sure all you procedures also have nvarchar datatype

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.