0

When I use an Arabic value in an HQL query, it returns null.

I added the unicode and UTF in MySQL datasource.

I got SQL generated from the Hibernate query and ran it in workbench, and it gave me a result:

Query q = se.createQuery("from Days where d_name = 'الخميس' " );

I run the generated SQL query on workbench and it gives me a result. I also tried to query with d_id and it runs without problems, so i think that the problem is with Arabic values.

I expect the result to come back as an object, but it returns null!

nsandersen
  • 896
  • 2
  • 16
  • 41

1 Answers1

0

Although Adding N before arabic values might solve you problem but Prefixing all values with N can cause horrific performance issues - often, this will cause queries to result in full table scans rather than index lookups.

You can find out a way by using utf-8 as suggested here

Alien
  • 15,141
  • 6
  • 37
  • 57