Hi,
I need 'special case' org.hibernate.criterion.Criterion implementation that will
NOT evaluate to any sql expression and will
NOT create additional AND entry (or other) in output SQL.
The reason of this is that I want to get rid of all the conditional logic with assembling Criteria. e.g:
Code:
if (lastName != null) {
userProfileCriteria.add(Restrictions.eq("lastName", lastName);
}
In future we can create a Criterion hierarchy that may check if given value is null, and if so, don't evaluate to any sql fragment.
For now, 'special case' Criterion is enough since you can arrange your code and get rid of null checking conditional logic, creating 'special case' criterion when is needed.
Or perhaps there is already something similar in Hibernate?
Thanks,
Szczepan