- added
EqualIgnoreCase
specification - introduced
Null
specification which accepts a boolean HTTP param to dynamically addis null
oris not null
part to the query - introduced
onTypeMismatch
property of@Spec
to define whether an exception should be thrown or empty result returned when an invalid value is passed (e.g. a non numeric value while field type isInteger
). Default behaviour is to return an empty result, which is a breaking change (an exception was thrown in previous versions). UseonTypeMismatch=EXCEPTION
to match old behaviour.
- fixed stack overflow issue with annotated interfaces!
- added
GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
specs DateAfter
,DateBefore
and their invlusive versions are now deprecated (use the above specs)
- added
@JoinFetch
and@Joins
(see README.md for the details)
- added date inclusive specs
-
it is now allowed to annotate a custom interface that extends
Specification
, eg.:@Or({ @Spec(path="firstName", params="name", spec=Like.class), @Spec(path="lastName", params="name", spec=Like.class) }) public interface FullNameSpec extends Specification<Customer> { }
it can be then used as controller parameter without further annotations, i.e.:
@RequestMapping("/customers") @ResponseBody public Object findByFullName(FullNameSpec spec) { return repository.findAll(spec); }
-
added optional
constVal
attribute in@Spec
. It allows to define a constant part of the query that does not use any HTTP parameters, e.g.:@And({ @Spec(path="deleted", spec=Equal.class, constVal="false"), @Spec(path="firstName", spec=Like.class) })
for handling requests such as
GET /customers?firstName=Homer
and executing queries such as:select c from Customer c where c.firstName like %Homer% and c.deleted = false
-
it is possible to combine parameter and interface annotations. They are combined with 'and' operator. For example you can create a basic interface like:
@Spec(path="deleted", spec=Equal.class, constVal="false") public interface NotDeletedEntitySpec<T> extends Specification<T> {}
And use it for your queries in the controller:
@RequestMapping("/customers") @ResponseBody public Object findNotDeletedCustomerByLastName( @Spec(path="lastName", spec=Equal.class) NotDeletedEntitySpec<Customer> spec) { return repository.findAll(spec); }
-
Equal
andIn
now support boolean values correctly -
introduced
IsNull
specification -
introduced
@Conjunction
and@Disjunction
for nesting ands and ors within each other
- introduced
DateAfter
specification - introduced
Equal
that supports exact match for numbers, strings, dates and enums - introduced
In
that supports in operator for numbers, strings, dates and enums - deprecated
EqualEnum
(useEqual
andIn
)