Hibernate version:3.2.1.ga
Spring version:2.0.6
and JPA.
Hi,
My application is working with unicode data and at times I need to do string comparisons with unicode data. According to the Microsoft documentation I need to prefix unicode string literals with N
For example
select * from places where places.neighbourhood in ('Dōngchéng')
needs to be
select * from places where places.neighbourhood in (N'Dōngchéng')
unfortunately when I attempt put this literal into the JPA query string I get the following error:
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 'city centre' near line 1, column 148 [SELECT poi from au.com.worldguide.model.Poi poi WHERE poi.destination.id = ? AND poi.poiType.id = ? AND poi.addressNeighbourhood IN (N'city centre', N'CBD', N'Neighbourhood', N'Darlinghurst', N'Paddington') ]; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 'city centre' near line 1, column 148 [SELECT poi from au.com.worldguide.model.Poi poi WHERE poi.destination.id = ? AND poi.poiType.id = ? AND poi.addressNeighbourhood IN (N'city centre', N'CBD', N'Neighbourhood', N'Darlinghurst', N'Paddington') ]
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 'city centre' near line 1, column 148 [SELECT poi from au.com.worldguide.model.Poi poi WHERE poi.destination.id = ? AND poi.poiType.id = ? AND poi.addressNeighbourhood IN (N'city centre', N'CBD', N'Neighbourhood', N'Darlinghurst', N'Paddington') ]
It appears to have an issue with the N, is there anyway around this?
I must be missing something...
|