Hello.
We are using Hibernate to get objects from Oracle SQL DB. We are using UTF-8 Database encoding with JAVA.
We have HQL query like this:
DEBUG {934335468@127.0.0.1/POST} org.hibernate.hql.ast.QueryTranslatorImpl - HQL: select changeRequest from ChangeRequestBrief as changeRequest where upper(changeRequest.evidenceNumber) like '你好%'ESCAPE'\'
But this query get's translated to: DEBUG {934335468@127.0.0.1/POST} org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select changerequ0_.CHNG_REQ_ID as CHNG1_, changerequ0_.EVIDENCE_NR as EVIDENCE2_42_, changerequ0_.RECEIVED_DATE as RECEIVED3_42_, changerequ0_.ORIG_REF_NR as ORIG4_42_, changerequ0_.ORG_ID as ORG5_42_, changerequ0_.COPY_TO as COPY6_42_, changerequ0_.STATE_ID as STATE7_42_, changerequ0_.USER_ID as USER8_42_, changerequ0_.INS_DATE as INS9_42_, nvl((SELECT susers.user_name FROM susers WHERE susers.user_id = changerequ0_.user_id),'Unknown User (' || changerequ0_.user_id || ')') as formula15_ from SCHNG_REQ changerequ0_ where (upper(changerequ0_.EVIDENCE_NR)like '??%' escape '\')
The like '??%' are real '?'. Cheched in HEX editor. it is 0x3F 0x3F.
I am logging to file with UTF-8. So logs are OK.
With normal JAVA oracle SQL connection I can filter by chinese chars.
So problem is with HQL to SQL translate.
Any suggestions.
|