Hibernate Version: 3.2.0-cr5
I have an Inheritance Hierarchy with classes B, C and D subclassing a baseclass A. (A is abstract).
Code:
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("none")
public abstract class A {
I had a built a search screen on entity A, the underlying java code was something like,
Code:
Criteria myCriteria = session.createCriteria(A.class);
//take each and every field from the UI
//add it to myCriteria
Now In the UI, I am also presenting the user to search only classes of type B or C or D (Note that there could be multiple choices from user)
If user checks on B and C then I will have to search only those classes. Class A has a discriminator column at the table level. But if I filter based on that using Hibernate criteria API, it is giving
nested exception is org.hibernate.QueryException: could not resolve property: type of: com.A
And the session.createCriteria API takes only one class. Can someone suggest some solution for this?