(sorry - I'm write from notebook, now havn't any IDE, syntax-errors may present in code)
I'm use JPA and Hibernate as provider.
I have a next classes-hierarchy:
Code:
@Entity
@Inheritance(InheritanceType=JOINED)
public abstract class CLS {
// ...
}
@Entity
public class CLS1 extends CLS {
// ...
}
@Entity
public class CLS2 extends CLS {
// ...
}
// ...
@Entity
public class CLS_nnn extends CLS {
// ...
}
I wanna retreive per
one request entities CLS1 and CLS2 (but not CLS3, CLS4 etc). For example, without any additional conditions. I'm wrote next code:
Code:
EntityManager em = ...
TypedQuery tq<CLS> = em.createQuery("SELECT c FROM CLS WHERE TYPE(c) = CLS1 OR TYPE(c) = CLS2", CLS.class);
List<CLS> result = tq.getResultList();
...but I get an empty list.
What wrong?