我有这个 JPA 实体
@Entity @Table(name = "Todos")
public class Todo {
@Id @GeneratedValue
private Long id;
...
@CollectionTable(name = "Doers", joinColumns = @JoinColumn(name = "id"))
@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
@NotEmpty
private final Set<String> doers = new HashSet<>(); // emails
@Email
private String owner;
}
当特定的执行者附加到它们时,我需要我的 JpaRepository 为我获取所有的 todo 实例。
ie Iterable findAllByDoersContaining(String email) // 集合扫描
我会说,这与 findByOwnerIn(Collection doers) 完全相反。是否有可能实现该连接?
感谢您的任何提示。