Function call in where clause for querydsl sql

231 views
Skip to first unread message

Murat Birben

unread,
May 18, 2016, 5:08:49 AM5/18/16
to Querydsl
Hi all,

I want to call a function in my where clause. I look at the documentations. In http://www.querydsl.com/static/querydsl/2.1.0/reference/html/ch02s04.html there is a section "Custom syntax expressions" but when I look at http://www.querydsl.com/static/querydsl/4.0.7/reference/html/ch02s03.html which is the version I'm using I could not see any section called "Custom syntax expressions".

Therefore the code snippet
Expression<String> expression = SimpleTemplate.create(String.class, "myfunction({0},{1})", arg1, arg2);


gives compilation error in 4.0.7.

I'm calling the function
Expressions.stringTemplate("myfunc()")

in an insert statement to call a function and it works pretty well. However in the where clause I need a byte[] return type from the function but I'm unable to do it.

Do you have any advice?

Thanks in advance,
Murat


Murat Birben

unread,
May 18, 2016, 7:40:53 AM5/18/16
to Querydsl
Hi again,

Sorry for disturbing you. I resolved my problem.

Expression<byte[]> expression = Expressions.simpleTemplate(byte[].class, "myfunc({0})", myvar);

solved my problem.

Best,
Murat
Reply all
Reply to author
Forward
0 new messages