I do it like this way :
Code:
Criteria criteria = session.createCriteria(Affaire.class);
if (auteur.getNom() != null && auteur.getNom().length > 0) {
Criteria manyToMany = criteria.createCriteria("auteurs");
manyToMany.add(Expression.like("nom","%" +
auteur.getNom() " +"%")
}
......
if (distrcit.getLibelleFr() != null && distrcit.getLibelleFr().length > 0) {
Criteria manyToMany = criteria.createCriteria("communes");
Criteria distrcitCriteria = manyToMany.createCriteria("district")
distrcitCriteria .add(Expression.like("libelleFr","%" +
district.getLibelleFr() " +"%")
}
}
but that's doesn't work for district ...
Does a sqlRestriction could help me to solve this case ?
thx in advance