I have an Entity Class like this:
@Entity
@Table(name = \"CUSTOMER\")
class Customer{
@Id
@Column(name = \"Id\")
Long id;
@Column(name = \"EM
It is maybe cleaner using a projection :
@Entity
@Table(name = "CUSTOMER")
class CustomerQueryData {
@Id
@Column(name = "Id")
Long id;
@OneToOne
@JoinColumns(@JoinColumn(name = "emailId"), @JoinColumn(name = "mobile"))
Contact contact;
}
The Contact Entity :
@Entity
@Table(name = "CUSTOMER")
class Contact{
@Column(name = "EMAIL_ID")
String emailId;
@Column(name = "MOBILE")
String mobile;
}
After specifying the entities, the repo :
CustomerJpaProjection extends Repository, QueryDslPredicateExecutor {
@Override
List findAll(Predicate predicate);
}
And the repo call :
ArrayList contacts = new ArrayList<>();
contacts.add(new Contact("a@b.c","8971"));
contacts.add(new Contact("e@f.g", "8888"));
customerJpaProjection.findAll(QCustomerQueryData.customerQueryData.contact.in(contacts));
Not tested code.