We're using Apache Cayenne to integrate an already existing MS SQL Server database with our application (I have no permission to change the database DDL, including the table/schema/database collation).
The database is using a specific collation (croatian) which defines single characters like "nj" and "dž", so when I do a LIKE
query:
select * from table where name like '%N%'
I get zero results, on the other hand If i do:
select * from table where name like '%NJ%'
I get multiple results.
Obviously this is simple to fix by adding collate
to the end of the query, but I know of no way of doing this with Cayenne. Any way to implement this without dropping the ORM-benefits as a whole?
tl;dr: Is there any way to preprocess queries before going to the database, like so:
query = query + ' collate SQL_Latin1_General_CP1_CI_AS'