I'm using DetachedCriteria in all findByCriteria methods(although I don't know why :)) and it seems eclipse won't accept that :
Code:
public List findByCriteria(Class clazz, String hekim) {
DetachedCriteria criteria = DetachedCriteria.forEntityName(clazz.getName());
String names[] = patient.split(" ");
for(int i = 0;i < names.length;i++){
criteria = Restrictions.or(criteria, Expression.like("Patient_Name", names[i]));
criteria = Restrictions.or(criteria, Expression.like("patient_surname", names[i]));
}
List list = super.getHibernateTemplate().findByCriteria(criteria);
return list;
}
Code:
The method or(Criterion, Criterion) in the type Restrictions is not applicable for the arguments (DetachedCriteria, SimpleExpression)
Should i change DetachedCriteria to Criterion?is it absolutely necessary?
How should I use Expression.like(asd,asd) in this "or" method?
Thanks for the quick reply btw.