Search in sources :

Example 1 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class JPABase method createQuery4.

@Test
@NoHibernate
@ExcludeIn(Target.DERBY)
public void createQuery4() {
    List<Tuple> rows = query().from(cat).select(new Expression<?>[] { Expressions.nullExpression() }).fetch();
    for (Tuple row : rows) {
        assertNotNull(row);
        assertEquals(1, row.size());
        assertNull(row.get(Expressions.nullExpression()));
    }
}
Also used : Expression(com.querydsl.core.types.Expression) BooleanExpression(com.querydsl.core.types.dsl.BooleanExpression) Tuple(com.querydsl.core.Tuple) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 2 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class AbstractJPATest method add_bigDecimal.

@Test
@ExcludeIn(ORACLE)
public void add_bigDecimal() {
    QSimpleTypes entity = new QSimpleTypes("entity1");
    QSimpleTypes entity2 = new QSimpleTypes("entity2");
    NumberPath<BigDecimal> bigd1 = entity.bigDecimal;
    NumberPath<BigDecimal> bigd2 = entity2.bigDecimal;
    assertEquals(Collections.emptyList(), query().from(entity, entity2).where(bigd1.add(bigd2).loe(new BigDecimal("1.00"))).select(entity).fetch());
}
Also used : BigDecimal(java.math.BigDecimal) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 3 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class AbstractJPATest method joinEmbeddable.

@Test
@NoEclipseLink
@ExcludeIn({ ORACLE, TERADATA })
public void joinEmbeddable() {
    QBookVersion bookVersion = QBookVersion.bookVersion;
    QBookMark bookMark = QBookMark.bookMark;
    assertEquals(Collections.emptyList(), query().from(bookVersion).join(bookVersion.definition.bookMarks, bookMark).where(bookVersion.definition.bookMarks.size().eq(1), bookMark.page.eq(2357L).or(bookMark.page.eq(2356L))).select(bookVersion).fetch());
}
Also used : QBookVersion(com.querydsl.jpa.domain4.QBookVersion) QBookMark(com.querydsl.jpa.domain4.QBookMark) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 4 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class AbstractJPATest method substring2.

@Test
@NoBatooJPA
@ExcludeIn({ ORACLE, SQLSERVER, HSQLDB })
public void substring2() {
    QCompany company = QCompany.company;
    StringExpression name = company.name;
    Integer companyId = query().from(company).select(company.id).fetchFirst();
    JPQLQuery<?> query = query().from(company).where(company.id.eq(companyId));
    String str = query.select(company.name).fetchFirst();
    assertEquals(Integer.valueOf(29), query.select(name.length().subtract(11)).fetchFirst());
    assertEquals(str.substring(0, 7), query.select(name.substring(0, 7)).fetchFirst());
    assertEquals(str.substring(15), query.select(name.substring(15)).fetchFirst());
    assertEquals(str.substring(str.length()), query.select(name.substring(name.length())).fetchFirst());
    assertEquals(str.substring(str.length() - 11), query.select(name.substring(name.length().subtract(11))).fetchFirst());
}
Also used : BigInteger(java.math.BigInteger) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 5 with ExcludeIn

use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.

the class AbstractJPATest method transform_groupBy2.

@Test
@ExcludeIn(DERBY)
public void transform_groupBy2() {
    QCat kitten = new QCat("kitten");
    Map<List<?>, Group> result = query().from(cat).innerJoin(cat.kittens, kitten).transform(GroupBy.groupBy(cat.id, kitten.id).as(cat, kitten));
    assertFalse(result.isEmpty());
    for (Tuple row : query().from(cat).innerJoin(cat.kittens, kitten).select(cat, kitten).fetch()) {
        assertNotNull(result.get(Arrays.asList(row.get(cat).getId(), row.get(kitten).getId())));
    }
}
Also used : Group(com.querydsl.core.group.Group) MockTuple(com.querydsl.core.group.MockTuple) Test(org.junit.Test) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Aggregations

ExcludeIn (com.querydsl.core.testutil.ExcludeIn)41 Test (org.junit.Test)39 Tuple (com.querydsl.core.Tuple)10 SQLInsertClause (com.querydsl.sql.dml.SQLInsertClause)6 ResultSet (java.sql.ResultSet)6 SAnimal (com.querydsl.jpa.domain.sql.SAnimal)4 QEmployee (com.querydsl.sql.domain.QEmployee)4 BigDecimal (java.math.BigDecimal)4 Date (java.sql.Date)4 Ignore (org.junit.Ignore)4 AbstractBaseTest (com.querydsl.sql.AbstractBaseTest)3 Group (com.querydsl.core.group.Group)2 IncludeIn (com.querydsl.core.testutil.IncludeIn)2 BigInteger (java.math.BigInteger)2 Timestamp (java.sql.Timestamp)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 MockTuple (com.querydsl.core.group.MockTuple)1 Expression (com.querydsl.core.types.Expression)1 BooleanExpression (com.querydsl.core.types.dsl.BooleanExpression)1 StringPath (com.querydsl.core.types.dsl.StringPath)1