Constance 가 필요하면
Expressions.constant(xxx)사용
@Test // Constant
public void testConstant() {
List<Tuple> tuples = queryFactory
.select(slave.slaveName, Expressions.constant("NIGGER"))
.from(slave)
.fetch();
for (Tuple tuple : tuples) {
System.out.println("⚠️⚠️⚠️⚠️ Tuple: " + tuple);
}
}
⚠️⚠️⚠️⚠️ Tuple: [slave1, NIGGER]
⚠️⚠️⚠️⚠️ Tuple: [slave2, NIGGER]
⚠️⚠️⚠️⚠️ Tuple: [slave3, NIGGER]
⚠️⚠️⚠️⚠️ Tuple: [slave4, NIGGER]
Concat 사용
@Test // Character
public void testCharacter() {
String res = queryFactory
.select(slave.slaveName.concat("_").concat(slave.age.stringValue()))
.from(slave)
.where(slave.slaveName.eq("slave1"))
.fetchOne();
System.out.println("⚠️⚠️⚠️⚠️ Character Result: " + res);
}
⚠️⚠️⚠️⚠️ Character Result: slave1_10