http://source.mysema.com/static/querydsl/2.1.1/reference/html/ch01.html

1. 소개

1-1. 배경

문자열 연결해서 쿼리 만들면 코드 읽기가 어렵다. 타입 안전성을 보장하지도 못한다.

도메인 모델을 타입 안정한 방법으로 변경할 수 있다는 것은 소프트웨어 개발에 큰 장점이다.

QueryDSL은 처음에 HQL을 타겟으로 작업했지만, 요즘은 콜렉션, JDO, JDBC, Lucene, Hibernate Search, MongoDB, RDFBean 등을 지원한다.

1-2. 원칙

타입 안전성(Type safety)가 QueryDSL의 핵심 원칙이다. 도메인 타입을 통해 생성된 쿼리 타입과 속성을 사용하고, 메서드 호출 역시 모두 타입 안전한 방식으로 처리한다.

일관성(Consistency) 역시 중요한 원칙이다. 공통의 쿼리 인터페이스를 기반으로 여러 구현체를 제공한다.

모든 쿼리 인스턴스를 계속해서 재사용할 수 있다.

주요 API

http://source.mysema.com/static/querydsl/2.1.1/apidocs/com/mysema/query/Query.html

Query defines the main query interface of the fluent query language.

Note that the from method has been left out, since there are implementation specific variants of it.

http://source.mysema.com/static/querydsl/2.1.1/apidocs/com/mysema/query/Projectable.html

Projectable defines default projection methods for Query implementations. All Querydsl query implementations should implement either this interface or SimpleProjectable.

http://source.mysema.com/static/querydsl/2.1.1/apidocs/com/mysema/query/types/Expression.html

Expression defines a general typed expression in a Query instance. The generic type parameter is a reference to the type the expression is bound to.