@@ -0,0 +1,1747 @@
+package com.vladmihalcea.book.hpjp.hibernate.criteria;%0A%0Aimport com.vladmihalcea.book.hpjp.util.AbstractTest;%0Aimport com.vladmihalcea.book.hpjp.util.providers.BlogEntityProvider;%0Aimport org.junit.Test;%0A%0Aimport javax.persistence.Tuple;%0Aimport javax.persistence.criteria.CriteriaBuilder;%0Aimport javax.persistence.criteria.CriteriaQuery;%0Aimport javax.persistence.criteria.Path;%0Aimport javax.persistence.criteria.Root;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * EntityGraphMapperTest - Test mapping to entity%0A *%0A * @author Vlad Mihalcea%0A */%0Apublic class TupleTest extends AbstractTest %7B%0A%0A    private BlogEntityProvider entityProvider = new BlogEntityProvider();%0A%0A    @Override%0A    protected Class%3C?%3E%5B%5D entities() %7B%0A        return entityProvider.entities();%0A    %7D%0A%0A    @Override%0A    public void init() %7B%0A        super.init();%0A        doInJPA(entityManager -%3E %7B%0A            entityManager.persist(new BlogEntityProvider.Post(1L));%0A            entityManager.persist(new BlogEntityProvider.Post(2L));%0A        %7D);%0A    %7D%0A%0A    @Test%0A    public void testTuple() %7B%0A        doInJPA(entityManager -%3E %7B%0A            CriteriaBuilder cb = entityManager.getCriteriaBuilder();%0A            CriteriaQuery%3CTuple%3E cq = cb.createTupleQuery();%0A%0A            Root%3CBlogEntityProvider.Post%3E postRoot = cq.from(BlogEntityProvider.Post.class);%0A            Path%3CLong%3E idPath = postRoot.get(%22id%22);%0A            Path%3CString%3E titlePath = postRoot.get(%22title%22);%0A            cq.multiselect(idPath, titlePath);%0A%0A            List%3CTuple%3E resultList = entityManager.createQuery(cq).getResultList();%0A%0A            for (Tuple tuple : resultList) %7B%0A                Long id = tuple.get(idPath);%0A                String title = tuple.get(titlePath);%0A            %7D%0A        %7D);%0A    %7D%0A%7D%0A

Add TupleTest