Search in sources :

Example 1 with Reptile

use of org.hibernate.test.hql.Reptile in project hibernate-orm by hibernate.

the class CriteriaQueryTest method testClassProperty.

@Test
public void testClassProperty() {
    Session s = openSession();
    Transaction t = s.beginTransaction();
    // HQL: from Animal a where a.mother.class = Reptile
    Criteria c = s.createCriteria(Animal.class, "a").createAlias("mother", "m").add(Property.forName("m.class").eq(Reptile.class));
    c.list();
    t.rollback();
    s.close();
}
Also used : Reptile(org.hibernate.test.hql.Reptile) Transaction(org.hibernate.Transaction) Criteria(org.hibernate.Criteria) DetachedCriteria(org.hibernate.criterion.DetachedCriteria) Session(org.hibernate.Session) Test(org.junit.Test)

Aggregations

Criteria (org.hibernate.Criteria)1 Session (org.hibernate.Session)1 Transaction (org.hibernate.Transaction)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 Reptile (org.hibernate.test.hql.Reptile)1 Test (org.junit.Test)1