Załóżmy, że mam podmiotów (pobierające/ustawiające i różne szczegóły pominięte dla zwięzłości):Wiosna kwerendy danych, gdzie kolumna jest null
@Entity
class Customer{
...
@OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
Collection<Coupon> coupons;
}
@Entity
class Coupon{
...
@Temporal(value = TemporalType.TIMESTAMP)
private Date usedOn;
@ManyToOne(fetch = FetchType.LAZY)
@NotNull
Customer customer;
}
Chciałbym odzyskać wszystkie kupony dla danego klienta mającego zerowy usedOn. I 've bezskutecznie zdefiniowane metody w CouponRepository jak opisano w docs
@Repository
public interface CouponRepository extends CrudRepository<Coupon, Long> {
Collection<Coupon> findByCustomerAndUsedOnIsNull(Customer);
}
ale prowadzi to na błąd kompilatora Syntax error, insert "... VariableDeclaratorId" to complete FormalParameterList
.