- introduced
NotNullspecification
- bumped dependencies to the latest Spring Boot version and JPA 2.1 API
- added
EqualIgnoreCasespecification - introduced
Nullspecification which accepts a boolean HTTP param to dynamically addis nulloris not nullpart to the query - introduced
onTypeMismatchproperty of@Specto 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=EXCEPTIONto match old behaviour.
- fixed stack overflow issue with annotated interfaces!
- added
GreaterThan,GreaterThanOrEqual,LessThan,LessThanOrEqualspecs DateAfter,DateBeforeand their invlusive versions are now deprecated (use the above specs)
- added
@JoinFetchand@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
constValattribute 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=Homerand 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); }
-
EqualandInnow support boolean values correctly -
introduced
IsNullspecification -
introduced
@Conjunctionand@Disjunctionfor nesting ands and ors within each other
- introduced
DateAfterspecification - introduced
Equalthat supports exact match for numbers, strings, dates and enums - introduced
Inthat supports in operator for numbers, strings, dates and enums - deprecated
EqualEnum(useEqualandIn)