I would like to create criteria or add restriction to my existing criteria (i think it has to be criteria) that will ignore "-" when searching for data's.
E.g I'm searching for number "888" and I would like to get "8-8-8" too.
I have bean that contains my number field
A.java
@Data
public class A {
[...]
@Length(max = 16)
@Column(length = 16)
private String number;
}
And here's my criteria
public Pair<Long, List<A>> filter(CompoundFilter filter, CompoundSort sort, int start, int count) {
Criteria criteria = getSession().createCriteria(A.class, "a_alias");
...
}
What should I add to criteria to achieve my goal?
My other idea is to create some hidden field (by hidden i mean the one that i wont use on UI, only fill with datas) that will hold "transformed" values and when filtering number
i will filter on this field