Does anyone know how to change this to JPA? and if there are any alternatives for the org.hibernate.criterion.Restrictions API? Thank you!
public void initShowAFilterCriteria (Criteria crit, ShowingAFilter filter, Object user) {
if(filter == null) {
return; // do nothing
}
switch (filter) {
case ALL;
break; // do nothing
case MINE;
crit.add(Restrictions.or(Restrictions.isNull("something"),
Restrictions.eq("something.id", user.getId())));
crit.add(Restrictions.eq(Object.A_CONSTANT, "N"));
break;
/**
* the rest of the switch statments are in a similar construct
*/
}
}