use of com.querydsl.core.domain.QAnimal in project querydsl by querydsl.
the class JPQLSerializerTest method treated_path.
@Test
public void treated_path() {
QAnimal animal = QAnimal.animal;
JPQLSerializer serializer = new JPQLSerializer(HQLTemplates.DEFAULT);
QueryMetadata md = new DefaultQueryMetadata();
md.addJoin(JoinType.DEFAULT, animal);
md.addWhere(JPAExpressions.treat(animal, QCat.class).breed.eq(1));
md.setProjection(animal);
serializer.serialize(md, false, null);
assertEquals("select animal\n" + "from Animal animal\n" + "where treat(animal as Cat).breed = ?1", serializer.toString());
}
Aggregations