"Consumer" is a joined subclass of "Party". The "Party" class contains a member variable "partyId".
If I were to create a Consumer object and set the partyId = 2, the partyId is never reflected in the generated sql where clause. Looking at the API for Session.createCriteria(), it says:
Quote:
Create a new Criteria instance, for the given entity class, or a superclass of an entity class.
I did not see that you anything that indicates that you need to handle superclasses differently. Am I doing this wrong? Here is what I am using in my Dao:
Code:
public Consumer getByExample(final Consumer example) {
HibernateCallback callback = new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
Criteria crit = session.createCriteria(Consumer.class);
crit.add(Example.create(example));
return (Consumer)crit.uniqueResult();
}
};
return (Consumer)getHibernateTemplate().execute(callback);
}
Your suggestions would be greatly appreciated.
Regards,
Joshua