简体   繁体   中英

Querydsl 4 StringTemplate creation

Is there an alternative to StringTemplate.create("") in QueryDsl 4?

In version 3 i could write things like this:

final StringExpression createdMonthYear = StringTemplate.create("to_char(CREATED_DATETIME, 'YYYY.MM')");

But since Querydsl 4 this won't work.

EDIT:

Nevermind. I found the answer...

final StringExpression createdMonthYear = Expressions.asString("to_char(CREATED_DATETIME, 'YYYY.MM')");

As OP found

final StringExpression createdMonthYear = Expressions.asString("to_char(CREATED_DATETIME,
'YYYY.MM')");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM