Yep - that's the only way to do it. I guess I don't think that's so bad for the situation you've presented - which is probably somewhat unusual.
Maybe something to do to improve the situation would be to add the ability to create a single disconnected Criteria class (instead of automatically add
Hi Jeff, One minor issue I had (till I refactored) in this area was that at one point I set some criteria in a base class, but sometimes wanted to set some additional "AND" clauses in a derived class. As such, I there needed to re-obtain the (single) Criteria instance, (which I did via
example.g
Hi Emiliano,
You are correct - you are using the Criteria class in just the way I had envisioned. But I (obviously) didn't account for the case where there are no criteria set :( I'll fix it for the next release. The workaround for now would be to not create the criteria class if there will be
Hello,
I have to add different and clauses in different place of my
code, 0 or more and clauses...
Which is the correct way to do it?
My solution is this:
TableExample.Criteria criteria = example.createCriteria();
if(StringUtils.isNotBlank(field1)){