Search in sources :

Example 11 with SAnimal

use of com.querydsl.jpa.domain.sql.SAnimal in project querydsl by querydsl.

the class JPAQueryMutabilityTest method test.

@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);
}
Also used : SAnimal(com.querydsl.jpa.domain.sql.SAnimal) QueryMutability(com.querydsl.core.QueryMutability) Cat(com.querydsl.jpa.domain.Cat) Test(org.junit.Test)

Example 12 with SAnimal

use of com.querydsl.jpa.domain.sql.SAnimal in project querydsl by querydsl.

the class HibernateSQLBase method entityQueries_createQuery.

@Test
public void entityQueries_createQuery() {
    SAnimal cat = new SAnimal("cat");
    QCat catEntity = QCat.cat;
    Query query = query().from(cat).select(catEntity).createQuery();
    assertEquals(6, query.list().size());
}
Also used : SAnimal(com.querydsl.jpa.domain.sql.SAnimal) QCat(com.querydsl.jpa.domain.QCat) Query(org.hibernate.query.Query) HibernateSQLQuery(com.querydsl.jpa.hibernate.sql.HibernateSQLQuery) Test(org.junit.Test)

Example 13 with SAnimal

use of com.querydsl.jpa.domain.sql.SAnimal in project querydsl by querydsl.

the class AbstractSQLTest method projections_duplicateColumns.

@Test
public void projections_duplicateColumns() {
    SAnimal cat = new SAnimal("cat");
    assertEquals(1, query().from(cat).select(Projections.list(cat.count(), cat.count())).fetch().size());
}
Also used : SAnimal(com.querydsl.jpa.domain.sql.SAnimal) Test(org.junit.Test)

Aggregations

SAnimal (com.querydsl.jpa.domain.sql.SAnimal)13 Test (org.junit.Test)13 ExcludeIn (com.querydsl.core.testutil.ExcludeIn)4 QCat (com.querydsl.jpa.domain.QCat)4 Tuple (com.querydsl.core.Tuple)3 Cat (com.querydsl.jpa.domain.Cat)3 QueryMutability (com.querydsl.core.QueryMutability)2 HibernateSQLQuery (com.querydsl.jpa.hibernate.sql.HibernateSQLQuery)2 Query (org.hibernate.query.Query)2 Ignore (org.junit.Ignore)2 DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)1 JPASQLQuery (com.querydsl.jpa.sql.JPASQLQuery)1 Configuration (com.querydsl.sql.Configuration)1 MySQLTemplates (com.querydsl.sql.MySQLTemplates)1 Query (javax.persistence.Query)1