Examples of HibernateQuery


Examples of com.mysema.query.jpa.hibernate.HibernateQuery

    @Test
    public void Clone() {
        QCat cat = QCat.cat;
        BooleanBuilder emptyBooleanBuilder = new BooleanBuilder();
        HibernateQuery hq = new HibernateQuery().from(cat).where(cat.name.isNull().and(emptyBooleanBuilder));

        HibernateQuery hq2 = hq.clone();
        assertNotNull(hq2);
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

        assertNotNull(hq2);
    }

    @Test
    public void InnerJoin() {
        HibernateQuery hqlQuery = new HibernateQuery();
        QEmployee employee = QEmployee.employee;
        hqlQuery.from(employee);
        hqlQuery.innerJoin(employee.user, QUser.user);
        assertEquals("select employee\nfrom Employee employee\n  inner join employee.user as user", hqlQuery.toString());
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

        assertEquals(Long.valueOf(3), query().from(cat).uniqueResult(cat.count()));
    }

    private HibernateQuery query() {
        return new HibernateQuery(session);
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

    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()) {
            System.out.println(results.get(0));
        }
        results.close();
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

public class HibernateQueryMutabilityTest{

    private Session session;

    protected HibernateQuery query() {
        return new HibernateQuery(session);
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

    @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

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

    }

    @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

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

    private Session session;

    @Override
    protected HibernateQuery query() {
        return new HibernateQuery(session, getTemplates());
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

        return new HibernateQuery(session, getTemplates());
    }

    @Override
    protected HibernateQuery testQuery() {
        return new HibernateQuery(new DefaultSessionHolder(session),
                getTemplates(), new DefaultQueryMetadata().noValidate());
    }
View Full Code Here

Examples of com.mysema.query.jpa.hibernate.HibernateQuery

        .fetch().list(sub);
    return initRelations(subs);
  }

  public List<FeedSubscription> findByCategory(User user, FeedCategory category) {
    HibernateQuery query = newQuery().from(sub).where(sub.user.eq(user));
    if (category == null) {
      query.where(sub.category.isNull());
    } else {
      query.where(sub.category.eq(category));
    }
    return initRelations(query.list(sub));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.