Package com.mysema.query.jpa.domain

Examples of com.mysema.query.jpa.domain.QCat


    }

    @Test
    public void EntityQueries_CreateQuery() {
        SAnimal cat = new SAnimal("cat");
        QCat catEntity = QCat.cat;

        Query query = query().from(cat).createQuery(catEntity);
        assertEquals(6, query.list().size());
    }
View Full Code Here


    @Test
    @ExcludeIn(Target.MYSQL)
    public void EntityQueries_CreateQuery2() {
        SAnimal cat = new SAnimal("CAT");
        QCat catEntity = QCat.cat;

        Query query = query().from(cat).createQuery(catEntity);
        assertEquals(6, query.list().size());
    }
View Full Code Here

        this.entityManager = entityManager;
    }

    @Test
    public void test() {
        QCat cat = QCat.cat;
        JPAQuery query = query().from(cat);

        query.count();
        assertProjectionEmpty(query);
        query.distinct().count();
View Full Code Here

        assertProjectionEmpty(query);
    }

    @Test
    public void Clone() {
        QCat cat = QCat.cat;
        JPAQuery query = query().from(cat).where(cat.name.isNotNull());
        JPAQuery query2 = query.clone(entityManager);
        assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
        assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
        query2.list(cat);
View Full Code Here

    @Test
    public void ById_Qdsl() {
        long start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            QCat cat = QCat.cat;
            Cat c = query().from(cat).where(cat.id.eq(i+100)).uniqueResult(cat);
            assertNotNull(c);
        }
        System.err.println("by id - dsl" + (System.currentTimeMillis() - start));
    }
View Full Code Here

    @Test
    public void ById_TwoCols_Qdsl() {
        long start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            QCat cat = QCat.cat;
            Tuple row = query().from(cat).where(cat.id.eq(i+100)).uniqueResult(cat.id, cat.name);
            assertNotNull(row);
        }
        System.err.println("by id - 2 cols - dsl" + (System.currentTimeMillis() - start));
    }
View Full Code Here

    @Test
    public void test() throws SecurityException, IllegalArgumentException,
            NoSuchMethodException, IllegalAccessException,
            InvocationTargetException, IOException {
        QCat cat = QCat.cat;
        HibernateQuery query = query().from(cat);
        new QueryMutability(query).test(cat, cat.name);
    }
View Full Code Here

        new QueryMutability(query).test(cat, cat.name);
    }

    @Test
    public void Clone() {
        QCat cat = QCat.cat;
        HibernateQuery query = query().from(cat).where(cat.name.isNotNull());
        HibernateQuery query2 = query.clone(session);
        assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
        assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
        query2.list(cat);
View Full Code Here

        }
    }

    @Test
    public void EntityQueries() {
        QCat catEntity = QCat.cat;

        List<Cat> cats = query().from(cat).orderBy(cat.name.asc()).list(catEntity);
        assertEquals(6, cats.size());
        for (Cat c : cats) {
            System.out.println(c.getName());
View Full Code Here

    }

    @Test
    public void EntityQueries2() {
        SAnimal mate = new SAnimal("mate");
        QCat catEntity = QCat.cat;

        List<Cat> cats = query().from(cat)
                .innerJoin(mate).on(cat.mateId.eq(mate.id))
                .where(cat.dtype.eq("C"), mate.dtype.eq("C"))
                .list(catEntity);
View Full Code Here

TOP

Related Classes of com.mysema.query.jpa.domain.QCat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.