简体   繁体   English

Querydsl 4 StringTemplate创建

[英]Querydsl 4 StringTemplate creation

Is there an alternative to StringTemplate.create("") in QueryDsl 4? QueryDsl 4中是否有StringTemplate.create(“”)的替代方法?

In version 3 i could write things like this: 在版本3中,我可以这样写:

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

But since Querydsl 4 this won't work. 但是,由于Querydsl 4不能使用。

EDIT: 编辑:

Nevermind. 没关系。 I found the answer... 我找到了答案...

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

As OP found 如OP所发现

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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