Package com.mysema.query.jpa.domain

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


        assertEquals(0l, query().from(cat).where(cat.name.eq("Bob")).count());
    }

    @Test
    public void Update_with_null() {
        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, (String)null)
            .set(cat.alive, false)
View Full Code Here


        assertEquals(1, amount);
    }

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

        QCat cat = QCat.cat;
        long amount = delete(cat).where(cat.name.eq("Bob"))
            .execute();
        assertEquals(1, amount);
View Full Code Here

        assertEquals(1, amount);
    }

    @Test
    public void Collection() throws Exception{
        List<Cat> cats = Arrays.asList(new Cat("Bob",10), new Cat("Steve",11));
        for (Cat cat : cats) {
            session.save(cat);
        }

        query().from(cat)
View Full Code Here

    }

    @Before
    public void setUp() {
        if (query().from(cat).notExists()) {
            session.save(new Cat("Beck", 1, Color.BLACK));
            session.save(new Cat("Kate", 2, Color.BLACK));
            session.save(new Cat("Kitty", 3, Color.BLACK));
            session.save(new Cat("Bobby", 4, Color.BLACK));
            session.save(new Cat("Harold", 5, Color.BLACK));
            session.save(new Cat("Tim", 6, Color.BLACK));
            session.flush();
        }
    }
View Full Code Here

    @Before
    public void setUp() {
        if (query().from(QCat.cat).notExists()) {
            for (int i = 0; i < iterations; i++) {
                entityManager.persist(new Cat(String.valueOf(i), i + 100));
            }
            entityManager.flush();
        }
    }
View Full Code Here

    @Test
    public void ById_Raw() {
        long start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            Cat cat = (Cat)entityManager.createQuery("select cat from Cat cat where id = ?")
                .setParameter(1, i + 100).getSingleResult();
            assertNotNull(cat);
        }
        System.err.println("by id - raw" + (System.currentTimeMillis() - start));
    }
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

    }

    @Before
    public void setUp() {
        if (query().from(cat).notExists()) {
            entityManager.persist(new Cat("Beck", 1, Color.BLACK));
            entityManager.persist(new Cat("Kate", 2, Color.BLACK));
            entityManager.persist(new Cat("Kitty", 3, Color.BLACK));
            entityManager.persist(new Cat("Bobby", 4, Color.BLACK));
            entityManager.persist(new Cat("Harold", 5, Color.BLACK));
            entityManager.persist(new Cat("Tim", 6, Color.BLACK));
            entityManager.flush();
        }
    }
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.