varsayalım ben varlıkları (getters/ayarlayıcılar ve kısaca geçilmiştir çeşitli ayrıntılar) vardır: Ben boş üzerinde gerçekleştirilmelidir sahip belirli bir Müşteri için tüm Kuponlar almak isteyenBahar veri sorgulama
@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;
}
. docs
@Repository
public interface CouponRepository extends CrudRepository<Coupon, Long> {
Collection<Coupon> findByCustomerAndUsedOnIsNull(Customer);
}
açıklandığı gibi, ama bu, bir derleyici hata Syntax error, insert "... VariableDeclaratorId" to complete FormalParameterList
üzerinde yol açar gibi, 'ettik başarısız CouponRepository bir yöntem tanımlamışlardır.