Spring Data - OR condition in a repository method name
<p>In my Spring Data project I have a following entity:</p>

<pre><code>@Entity
@NamedEntityGraph(name = "graph.CardPair", attributeNodes = {})
@Table(name = "card_pairs")
public class CardPair extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 7571004010972840728L;

    @Id
    @SequenceGenerator(name = "card_pairs_id_seq", sequenceName = "card_pairs_id_seq", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "card_pairs_id_seq")
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "card1_id")
    private Card card1;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "card2_id")
    private Card card2;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "selected_card_id")
    private Card selectedCard;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "board_id")
    private Board board;

....

}
</code></pre>

<p>I need to implement a Spring Data repository method that will look for a <code>CardPair</code> based on <code>cardPairId</code>, <code>board</code> and <code>card</code>. The more complicated case to me is a <code>Card</code> because I need to construct a condition where <code>card1 = card or card2 = card</code></p>

<p>Is it possible to provide this condition via Spring Data repository method name ?</p>

<p>For example</p>

<pre><code>cardPairRepository.findByIdAndBoardAnd[card1 = card or card2 = card]AndSelectedCardIsNull(cardPairId, board, card);
</code></pre>

<p>Is it possible to translate this condition <code>card1 = card or card2 = card</code> in a method name ?</p>