728x90
반응형
public List<Item> list(itemListRequestDto dto) {
        return query
            .select(item)
            .from(item)
            .where(
                Expressions.stringTemplate("CAST({0} AS text)", item.jsonObject)
                    .like("%" + dto.getSearchKeyword() + "%")
            )
            .orderBy(item.createdAt.desc())
            .fetch();
    }

json으로 된 column을 String으로 만들고 like 같은 메소드를 쓰고자 할 때 위와 같이 쓸 수 있다.

 

728x90
반응형

+ Recent posts