class Foo {
Long id;
String name;
int size;
String type;
}
class FooQo {
@QueryCondition(field="name", type=Condition.STARTS_WITH)
String namePrefix;
@QueryCondition(field="size", type=Condition.NOT_LESS_THAN)
int minSize;
@QueryCondition(field="size", type=Condition.NOT_GREATER_THAN)
int maxSize;
@QueryCondition(type=Condition.IN)
List<String> type;
}
FooQo fooQo = new FooQo("foo", 1, 10, Arrays.asList("A", "B"));
Specification<Foo> specification = SpecificationFactory.getSpecification(fooQo);
List<Foo> foos = fooRepository.findAll(specification);
SELECT * FROM FOO
WHERE LOWER(FOO.NAME) LIKE 'foo%'
AND FOO.SIZE >= 1
AND FOO.SIZE <= 10
AND FOO.TYPE IN ('A', 'B');