Package com.mysema.query.jpa.domain

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


    @Test
    public void test() throws SecurityException, IllegalArgumentException,
            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


    private Session session;

    @Test
    public void test() {
        session.save(new Cat("Bob1", 1));
        session.save(new Cat("Bob2", 2));
        session.save(new Cat("Bob3", 3));

        assertEquals(Integer.valueOf(1), query().from(cat).orderBy(cat.name.asc()).offset(0).limit(1).uniqueResult(cat.id));
        assertEquals(Integer.valueOf(2), query().from(cat).orderBy(cat.name.asc()).offset(1).limit(1).uniqueResult(cat.id));
        assertEquals(Integer.valueOf(3), query().from(cat).orderBy(cat.name.asc()).offset(2).limit(1).uniqueResult(cat.id));
View Full Code Here

public class CollectionTest extends AbstractQueryTest{

    @Test
    public void Constant_InElements_Set() {
        assertToString("?1 in elements(cat.kittensSet)", cat.kittensSet.contains(new Cat()));
    }
View Full Code Here

        assertToString("?1 in elements(cat.kittensSet)", cat.kittensSet.contains(new Cat()));
    }
   
    @Test
    public void Constant_InElements_List() {
        assertToString("?1 in elements(cat.kittens)", cat.kittens.contains(new Cat()));
    }
View Full Code Here

        query().from(cat).innerJoin(cat.mate, mate).leftJoin(cat.kittens, kitten).parse();
    }

    @Test
    public void DocoExamples93_viaAlias() throws Exception {
        Cat c = alias(Cat.class, "cat");
        Cat k = alias(Cat.class, "kittens");
        Cat m = alias(Cat.class, "mate");

        query().from($(c)).innerJoin($(c.getMate()),$(m)).leftJoin($(c.getKittens()),$(k)).parse();
    }
View Full Code Here

        query().from($(c)).innerJoin($(c.getMate()),$(m)).leftJoin($(c.getKittens()),$(k)).parse();
    }
   
    @Test
    public void DocoExamples93_viaAlias2() throws Exception {
        Cat c = alias(Cat.class, "cat");
        Cat k = alias(Cat.class, "kittens");
       
        query().from($(c)).leftJoin($(c.getMate().getKittens()),$(k)).parse();
    }
View Full Code Here

        query().from($(c)).leftJoin($(c.getMate().getKittens()),$(k)).parse();
    }
   
    @Test
    public void DocoExamples93_viaAlias3() throws Exception {
        Cat c = alias(Cat.class, "cat");
        Cat k = alias(Cat.class, "kittens");
        Cat m = alias(Cat.class, "mate");
    
        query().from($(c)).innerJoin($(c.getMate()),$(m)).leftJoin($(c.getKittens()),$(k)).parse();
    }
View Full Code Here

        query().from($(c)).innerJoin($(c.getMate()),$(m)).leftJoin($(c.getKittens()),$(k)).parse();
    }
   
    @Test
    public void DocoExamples93_viaAlias4() throws Exception {
        Cat c = alias(Cat.class, "cat");
        Cat k = alias(Cat.class, "kittens");
        Cat m = alias(Cat.class, "mate");
       
        query().from($(c)).innerJoin($(c.getMate()),$(m)).leftJoin($(c.getKittens()),$(k)).parse();       
    }   
View Full Code Here

        return new HibernateUpdateClause(session, entity);
    }

    @Test
    public void Scroll() {
        session.save(new Cat("Bob",10));
        session.save(new Cat("Steve",11));

        QCat cat = QCat.cat;
        HibernateQuery query = new HibernateQuery(session);
        ScrollableResults results = query.from(cat).scroll(ScrollMode.SCROLL_INSENSITIVE, cat);
        while (results.next()) {
View Full Code Here

        results.close();
    }

    @Test
    public void Update() {
        session.save(new Cat("Bob",10));
        session.save(new Cat("Steve",11));

        QCat cat = QCat.cat;
        long amount = update(cat).where(cat.name.eq("Bob"))
            .set(cat.name, "Bobby")
            .set(cat.alive, false)
View Full Code Here

TOP

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

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.