Customize JPQLTemplate escape char for QueryDSL queries

37 views
Skip to first unread message

teikiteetini-vaysse Loic

unread,
Jan 5, 2018, 5:15:52 AM1/5/18
to Querydsl

Hello, I post this here also. you can fint it on SO too : Customize JPQLTemplate escape char for QueryDSL queries


I am using QueryDSL to filter my request in a SpringBoot/Data/Rest context to query Apache Phoenix with generated SQL through the Phoenix JDBC Driver.

Problem is Phoenix SQL doesn't support the escape statement for example in like statements :

select * from data where value like 'toto%' escape '!';

Using QueryDSL 4.1.4 I am unable to generate statements like :

select * from data where value like 'toto%';

Searching for a workaround I found out the escape character was defined in the QueryDSL template used. As I use Hibernate, the template picked is HQLTemplates and as JPQLTemplates it uses the default escape char '!'.

Using the Spring Data naming convention I managed to generate the correct statement. Nonetheless using this method is way less flexible on filtering. So I really want to keep using QueryDSL.

Anyone has a clean workaround for this ?

Regards

Loïc

Reply all
Reply to author
Forward
0 new messages