728x90
반응형
SMALL
SELECT all columns
private final QDoc doc = QDoc.doc;
@Override public List<Doc> findAll(DocSearch search) {
return from(doc)
.where(
eqState(search.getStat()),
eqElucidatorDept(search.getEqDeptName()),
...
likeElucidator(search.getElucidator()),
likeElucidatorDept(search.getDeptName())
).fetch();
)
Select specific columns (using Tuple)
@Override
public List<DocDto> findAllForDashboard(DocSearch search) {
List<DocDto> rtnList = new ArrayList<>(); List
<Tuple> list = from(doc)
.where(
afterStartDate(search.getStartDate()),
beforeEndDate(search.getEndDate())
)
.select(doc.requestDate, doc.elucidateDate)
.fetchResults().getResults();
for (Tuple t : list) {
rtnList.add(new DocDto(t.get(0, LocalDateTime.class), t.get(1, LocalDateTime.class)));
}
return rtnList;
}
728x90
반응형
LIST
'IT > JPA' 카테고리의 다른 글
LocalDate, LocalTime JPA Timezone 문제 (0) | 2020.03.25 |
---|---|
[JPA] null value was assigned to a property of primitive type setter of (0) | 2019.11.14 |
Spring Data JPA + QueryDsl (2) | 2019.09.09 |
JPQL, NativeSQL, Criteria, QueryDSL, JOOQ... (0) | 2019.09.06 |
@OneToMany 단방향을 @ManyToOne 양방향으로 (2) | 2019.08.28 |