Home:ALL Converter>Hibernate Insert Greek Characters into Oracle

Hibernate Insert Greek Characters into Oracle

Ask Time:2017-01-13T08:36:15         Author:Maz

Json Formatter

I have a requirement of inserting greek characters, such as 'ϕ', into Oracle. My existing DB structure wasn't supporting it. On investigating found various solutions and I adopted the solution of using NCLOB instead of CLOB. It works perfectly fine when I use unicode, 03A6, for 'ϕ', and use UNISTR function in SQL editor to insert. Like the one below.

UPDATE config set CLOB = UNISTR('\03A6')

However, it fails when I try to insert the character through my application, using hibernate. On debugging, I find that the string before inserting is '\u03A6'. After insert, I see it as ¿.

Can some one please help me how I can resolve this? How do I make use of UNISTR?

PN: I don't use any native sqls or hqls. I use entity object of the table.

Edit:

Hibernate version used is 3.5.6. Cannot change the version as there are so many other plugins dependent on this. Thus, cannot use @Nationalized or @Type(type="org.hibernate.type.NClobType") on my field in Hibernate Entity

Author:Maz,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41625586/hibernate-insert-greek-characters-into-oracle
yy