I have spent couple of hours searching around and did not found anything similar to my case.
Let\'s assume following many-to-many data model:
Contract (an
You can use @WhereJoinTable annotation. It applies to the association table
@OneToMany
@JoinTable(
name="Contract_Party",
joinColumns = {@JoinColumn(name="party_id",referencedColumnName="party_id")},
inverseJoinColumns = {@JoinColumn(name="contract_id", referencedColumnName="contract_id")}
}
@WhereJoinTable ( "ROLE = 'SIGNER' ")
private List<Contract> contracts;
You must use:
@WhereJoinTable(clause = "ROLE ='SIGNER'")