crudrepository findBy method signature with multiple in operators?

我有一个这样的实体类:

@Entity
@Table(name = "EMAIL")
class Email{
@Id
@Column(name = "Id")
Long id;
@Column(name = "EMAIL_ID")
String emailId;
@Column(name = "PIN_CODE")
String pincode;
}

如何为下面的查询编写 findBy方法使用 cruditory Spring 数据 jpa?

select email_id,name from email_details where eamil_id in('mike@gmail.com','ram@gmail.com') and pin_code in('633677','733877')

我期望弹簧数据 jpa 方法像下面这样,但如何构造它?

List<Email> findBy.....(List<String> emails, List<String> pinCodes);

I want to get list of Emails in a single database hit.

184822 次浏览

以下签名即可:

List<Email> findByEmailIdInAndPincodeIn(List<String> emails, List<String> pinCodes);

SpringDataJPA 支持大量关键字来构建查询。