Entity A has ManyToMany relationship with Entity B. Class B is the base class for a class hierarchy, and C is a subclass of B in the class hierarchy.
class A {
List<B> getBList();
}
Query:
get all A(s) that have a instance of C.
Note that: C is a subclass of B. It is OO. If A has an instances of any subclass of C, then the A will be included in result set.
The following code will not work using class, which is exactly match, not OO idea.
List results = session.createCriteria(A.class)
.createCriteria("bList")
.add( Restrictions.eq("class", "B") )
.list();
any help are appreciated. Thanks!
Dave
|