# 상수, 문자 더하기

## 상수

```java
@SpringBootTest
@Transactional
public class QuerydslBasicTest {
    
    @Test
    public void constant() {
        Tuple result = queryFactory
                .select(member.username, Expressions.constant("A"))
                .from(member)
                .fetchFirst();
    }
}
```

```
result = [member1, A]
```

* Expressions.constant()를 사용한다.

## 문자 더하기

```java
@SpringBootTest
@Transactional
public class QuerydslBasicTest {
    
    @Test
    public void concat() {
        String result = queryFactory
                .select(member.username.concat("_").concat(member.age.stringValue()))
                .from(member)
                .where(member.username.eq("member1"))
                .fetchOne();
    }
}
```

```
member1_10
```

* ENUM과 문자가 아닌 타입은 stringValue()로 변환한다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dodeon.gitbook.io/study/kimyounghan-querydsl/03-basic/constant-and-string.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
