use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class IntegrationBase method update.
@Test
public void update() {
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, "Bobby").set(cat.alive, false).execute();
assertEquals(1, amount);
assertEquals(0L, query().from(cat).where(cat.name.eq("Bob")).fetchCount());
}
use of com.querydsl.jpa.domain.QCat 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();
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class IntegrationBase method update_with_null.
@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).execute();
assertEquals(1, amount);
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class AbstractSQLTest method entityQueries.
@Test
public void entityQueries() {
QCat catEntity = QCat.cat;
List<Cat> cats = query().from(cat).orderBy(cat.name.asc()).select(catEntity).fetch();
assertEquals(6, cats.size());
for (Cat c : cats) {
assertNotNull(c.getName());
}
}
use of com.querydsl.jpa.domain.QCat in project querydsl by querydsl.
the class AbstractSQLTest method entityQueries4.
@Test
@NoBatooJPA
@NoEclipseLink
public void entityQueries4() {
QCat catEntity = QCat.cat;
List<Tuple> cats = query().from(cat).select(catEntity, cat.name, cat.id).fetch();
assertEquals(6, cats.size());
for (Tuple tuple : cats) {
assertTrue(tuple.get(catEntity) instanceof Cat);
assertTrue(tuple.get(cat.name) instanceof String);
assertTrue(tuple.get(cat.id) instanceof Integer);
}
}
Aggregations