Lithium
Lithium

Reputation: 599

jpql equivalent for this sql query (query from national characters)

I have a sql query which works fine on sql server query window and returns results

sql query:

select * from table1 where title = N'تست'

if I put that 'N' in my query in sql, the query gets results and if I don't put 'N' no results will be returned.

the question is how can I have this query in jpql format (with that 'N')?

thanks for replying

Upvotes: 1

Views: 231

Answers (1)

Vlad Mihalcea
Vlad Mihalcea

Reputation: 153780

Try setting this Hibernate property:

hibernate.connection.defaultNChar=true

If you use an external DataSource (external connection pool like HikariCP) then you want to set the following property in the JDBC connection URL:

   sendStringParametersAsUnicode=true

Upvotes: 1

Related Questions