I have Spring Data REST application that uses QueryDsl. My application has a Car entity with a purchaseDate field:
@Entity
@Data
public class Car {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private LocalDate purchaseDate;
}
The CarRespository is exposed via Spring Data REST at localhost/api/cars:
public interface CarRepository extends CrudRepository<Car, Long>,
QuerydslPredicateExecutor<Car>, QuerydslBinderCustomizer<QCar> {
}
An HTTP client can find cars purchased on a date by making a GET request to:
localhost/api/cars?purchaseDate=2023-01-01
Is it possible for a HTTP client to request all cars that have a purchase date (i.e., purchaseDate is not null)? I know that I can add a repository method such as findByPurchaseDateNotNull to accomplish this but was wondering if either
- the HTTP client can some way specify "not null" or
- QueryDsl binding could be configured to handle a not null indication from the client