Package com.mysema.query.jpa.domain.sql

Examples of com.mysema.query.jpa.domain.sql.SAnimal


            NoSuchMethodException, IllegalAccessException,
            InvocationTargetException, IOException {
        entityManager.persist(new Cat("Beck", 1));
        entityManager.flush();

        SAnimal cat = new SAnimal("cat");
        JPASQLQuery query = query().from(cat);
        new QueryMutability(query).test(cat.id, cat.name);
    }
View Full Code Here


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

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

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

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

    @Test
    public void Clone() {
        SAnimal cat = new SAnimal("cat");
        HibernateSQLQuery query = query().from(cat).where(cat.name.isNotNull());
        HibernateSQLQuery query2 = query.clone(session);
        assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
        assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
        //query2.list(cat.id);
View Full Code Here

    @Test
    public void In() {
        Configuration conf = new Configuration(new MySQLTemplates());
        NativeSQLSerializer serializer = new NativeSQLSerializer(conf, true);
        DefaultQueryMetadata md = new DefaultQueryMetadata();
        SAnimal cat = SAnimal.animal_;
        md.addJoin(JoinType.DEFAULT, cat);
        md.addWhere(cat.name.in("X", "Y"));
        md.addProjection(cat.id);
        serializer.serialize(md, false);
        assertEquals("select animal_.id\n" +
View Full Code Here

        }
    }

    @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

        }
    }

    @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"))
View Full Code Here

    @Test
    @NoBatooJPA
    @NoEclipseLink
    public void EntityQueries5() {
        QCat catEntity = QCat.cat;
        SAnimal otherCat = new SAnimal("otherCat");
        QCat otherCatEntity = new QCat("otherCat");
        List<Tuple> cats = query().from(cat, otherCat).list(catEntity, otherCatEntity);
        assertEquals(36, cats.size());

        for (Tuple tuple : cats) {
View Full Code Here

        }
    }

    @Test
    public void Projections_DuplicateColumns() {
        SAnimal cat = new SAnimal("cat");
        assertEquals(1, query().from(cat).list(new QList(cat.count(), cat.count())).size());
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.jpa.domain.sql.SAnimal

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.