Search in sources :

Example 1 with HibernateQuery

use of com.querydsl.jpa.hibernate.HibernateQuery in project querydsl by querydsl.

the class IntegrationBase method scroll.

@Test
public void scroll() {
    session.save(new Cat("Bob", 10));
    session.save(new Cat("Steve", 11));
    QCat cat = QCat.cat;
    HibernateQuery<?> query = new HibernateQuery<Void>(session);
    ScrollableResults results = query.from(cat).select(cat).scroll(ScrollMode.SCROLL_INSENSITIVE);
    while (results.next()) {
        assertNotNull(results.get(0));
    }
    results.close();
}
Also used : QCat(com.querydsl.jpa.domain.QCat) HibernateQuery(com.querydsl.jpa.hibernate.HibernateQuery) Cat(com.querydsl.jpa.domain.Cat) QCat(com.querydsl.jpa.domain.QCat) ScrollableResults(org.hibernate.ScrollableResults) Test(org.junit.Test)

Example 2 with HibernateQuery

use of com.querydsl.jpa.hibernate.HibernateQuery in project querydsl by querydsl.

the class HibernateQueryTest method innerJoin.

@Test
public void innerJoin() {
    HibernateQuery<?> hqlQuery = new HibernateQuery<Void>();
    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());
}
Also used : HibernateQuery(com.querydsl.jpa.hibernate.HibernateQuery) QEmployee(com.querydsl.jpa.domain.QEmployee) Test(org.junit.Test)

Example 3 with HibernateQuery

use of com.querydsl.jpa.hibernate.HibernateQuery in project querydsl by querydsl.

the class HibernateQueryTest method clone_.

@Test
public void clone_() {
    QCat cat = QCat.cat;
    BooleanBuilder emptyBooleanBuilder = new BooleanBuilder();
    HibernateQuery<?> hq = new HibernateQuery<Void>().from(cat).where(cat.name.isNull().and(emptyBooleanBuilder));
    HibernateQuery<?> hq2 = hq.clone();
    assertNotNull(hq2);
}
Also used : QCat(com.querydsl.jpa.domain.QCat) BooleanBuilder(com.querydsl.core.BooleanBuilder) HibernateQuery(com.querydsl.jpa.hibernate.HibernateQuery) Test(org.junit.Test)

Aggregations

HibernateQuery (com.querydsl.jpa.hibernate.HibernateQuery)3 Test (org.junit.Test)3 QCat (com.querydsl.jpa.domain.QCat)2 BooleanBuilder (com.querydsl.core.BooleanBuilder)1 Cat (com.querydsl.jpa.domain.Cat)1 QEmployee (com.querydsl.jpa.domain.QEmployee)1 ScrollableResults (org.hibernate.ScrollableResults)1