Hello guys. Could someone please help me with my issue.
I am using hibernate 3.6. Here is what I need help with.
I have two classes FooParent and FooChild. As it stands from names FooChild extending FooParent.
When I am trying to find by criteria all FooParent classes it returns me FooChildes in list too.
I am searching like this.
Code:
DetachedCriteria criteria = DetachedCriteria.forClass(FooParent.class);
Adding some restrictions:
Code:
criteria.add(Restrictions.ilike(...));
Then calling for result list:
Code:
List result = getHibernateTemplate().findByCriteria(criteria);
.
The result list contains FooChildes also if they are matching the criteria. I want them to be removed from searching and result list subsequently. What need to be done to search criteria? I google my problem but only thing I've found is add restriction:
Code:
criteria.add(Restrictions.eq("class", FooParent));
Which is not working due to "there is no property 'class' of the bean FooParent" exception.