====== Hibernate HQL ====== ===== HQL 결과를 사용자 정의 객체로 전환 ===== * [[https://www.baeldung.com/hibernate-query-to-custom-class|Mapping A Hibernate Query To A Custom Class | Baeldung]] * HQL Constructor Query query = session.createQuery("select new com.baeldung.hibernate.pojo.Result(m.name, m.department.name)" + " from com.baeldung.hibernate.entities.DeptEmployee m"); List results = query.list(); * ResultTransformer Query query = session.createQuery("select m.name as employeeName, m.department.name as departmentName" + " from com.baeldung.hibernate.entities.DeptEmployee m"); query.setResultTransformer(Transformers.aliasToBean(Result.class)); List results = query.list(); * [[java:querydsl|QueryDSL]] 사용시에는 Projection 을 사용하면 된다.